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

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

Issue 253413002: Make opendir test for EINTR again and make NO_RETRY_EXPECTED check in release mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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_android.cc ('k') | runtime/bin/directory_macos.cc » ('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_LINUX) 6 #if defined(TARGET_OS_LINUX)
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (NO_RETRY_EXPECTED(lstat64(path->AsString(), &st)) == -1) { 238 if (NO_RETRY_EXPECTED(lstat64(path->AsString(), &st)) == -1) {
239 return false; 239 return false;
240 } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { 240 } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
241 return (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0); 241 return (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0);
242 } 242 }
243 243
244 if (!path->Add(File::PathSeparator())) return false; 244 if (!path->Add(File::PathSeparator())) return false;
245 245
246 // Not a link. Attempt to open as a directory and recurse into the 246 // Not a link. Attempt to open as a directory and recurse into the
247 // directory. 247 // directory.
248 DIR* dir_pointer = opendir(path->AsString()); 248 DIR* dir_pointer;
249 do {
250 dir_pointer = opendir(path->AsString());
251 } while (dir_pointer == NULL && errno == EINTR);
249 if (dir_pointer == NULL) { 252 if (dir_pointer == NULL) {
250 return false; 253 return false;
251 } 254 }
252 255
253 // Iterate the directory and delete all files and directories. 256 // Iterate the directory and delete all files and directories.
254 int path_length = path->length(); 257 int path_length = path->length();
255 dirent entry; 258 dirent entry;
256 dirent* result; 259 dirent* result;
257 while (NO_RETRY_EXPECTED(readdir_r(dir_pointer, &entry, &result)) == 0) { 260 while (NO_RETRY_EXPECTED(readdir_r(dir_pointer, &entry, &result)) == 0) {
258 if (result == NULL) { 261 if (result == NULL) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 bool Directory::Rename(const char* path, const char* new_path) { 436 bool Directory::Rename(const char* path, const char* new_path) {
434 ExistsResult exists = Exists(path); 437 ExistsResult exists = Exists(path);
435 if (exists != EXISTS) return false; 438 if (exists != EXISTS) return false;
436 return NO_RETRY_EXPECTED(rename(path, new_path)) == 0; 439 return NO_RETRY_EXPECTED(rename(path, new_path)) == 0;
437 } 440 }
438 441
439 } // namespace bin 442 } // namespace bin
440 } // namespace dart 443 } // namespace dart
441 444
442 #endif // defined(TARGET_OS_LINUX) 445 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/directory_android.cc ('k') | runtime/bin/directory_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698