Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: runtime/bin/directory_macos.cc

Issue 17158003: Report async errors when they happend, in directory listing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/directory.cc ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 9
10 #include <dirent.h> // NOLINT 10 #include <dirent.h> // NOLINT
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 bool PathBuffer::Add(const char* name) { 43 bool PathBuffer::Add(const char* name) {
44 char* data = AsString(); 44 char* data = AsString();
45 int written = snprintf(data + length_, 45 int written = snprintf(data + length_,
46 PATH_MAX - length_, 46 PATH_MAX - length_,
47 "%s", 47 "%s",
48 name); 48 name);
49 data[PATH_MAX] = '\0'; 49 data[PATH_MAX] = '\0';
50 if (written <= PATH_MAX - length_ && 50 if (written <= PATH_MAX - length_ &&
51 written >= 0 && 51 written >= 0 &&
52 static_cast<size_t>(written) == strnlen(name, PATH_MAX + 1)) { 52 static_cast<size_t>(written) == strlen(name)) {
53 length_ += written; 53 length_ += written;
54 return true; 54 return true;
55 } else { 55 } else {
56 errno = ENAMETOOLONG; 56 errno = ENAMETOOLONG;
57 return false; 57 return false;
58 } 58 }
59 } 59 }
60 60
61 void PathBuffer::Reset(int new_length) { 61 void PathBuffer::Reset(int new_length) {
62 length_ = new_length; 62 length_ = new_length;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 bool Directory::Rename(const char* path, const char* new_path) { 401 bool Directory::Rename(const char* path, const char* new_path) {
402 ExistsResult exists = Exists(path); 402 ExistsResult exists = Exists(path);
403 if (exists != EXISTS) return false; 403 if (exists != EXISTS) return false;
404 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0); 404 return (TEMP_FAILURE_RETRY(rename(path, new_path)) == 0);
405 } 405 }
406 406
407 } // namespace bin 407 } // namespace bin
408 } // namespace dart 408 } // namespace dart
409 409
410 #endif // defined(TARGET_OS_MACOS) 410 #endif // defined(TARGET_OS_MACOS)
OLDNEW
« no previous file with comments | « runtime/bin/directory.cc ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698