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

Side by Side Diff: runtime/bin/directory_android.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 | « no previous file | runtime/bin/directory_linux.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_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 if (NO_RETRY_EXPECTED(lstat(path->AsString(), &st)) == -1) { 237 if (NO_RETRY_EXPECTED(lstat(path->AsString(), &st)) == -1) {
238 return false; 238 return false;
239 } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) { 239 } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
240 return (unlink(path->AsString()) == 0); 240 return (unlink(path->AsString()) == 0);
241 } 241 }
242 242
243 if (!path->Add(File::PathSeparator())) return false; 243 if (!path->Add(File::PathSeparator())) return false;
244 244
245 // Not a link. Attempt to open as a directory and recurse into the 245 // Not a link. Attempt to open as a directory and recurse into the
246 // directory. 246 // directory.
247 DIR* dir_pointer = opendir(path->AsString()); 247 DIR* dir_pointer;
248 do {
249 dir_pointer = opendir(path->AsString());
250 } while (dir_pointer == NULL && errno == EINTR);
248 if (dir_pointer == NULL) { 251 if (dir_pointer == NULL) {
249 return false; 252 return false;
250 } 253 }
251 254
252 // Iterate the directory and delete all files and directories. 255 // Iterate the directory and delete all files and directories.
253 int path_length = path->length(); 256 int path_length = path->length();
254 dirent entry; 257 dirent entry;
255 dirent* result; 258 dirent* result;
256 while (NO_RETRY_EXPECTED(readdir_r(dir_pointer, &entry, &result)) == 0) { 259 while (NO_RETRY_EXPECTED(readdir_r(dir_pointer, &entry, &result)) == 0) {
257 if (result == NULL) { 260 if (result == NULL) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 bool Directory::Rename(const char* path, const char* new_path) { 445 bool Directory::Rename(const char* path, const char* new_path) {
443 ExistsResult exists = Exists(path); 446 ExistsResult exists = Exists(path);
444 if (exists != EXISTS) return false; 447 if (exists != EXISTS) return false;
445 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0); 448 return (NO_RETRY_EXPECTED(rename(path, new_path)) == 0);
446 } 449 }
447 450
448 } // namespace bin 451 } // namespace bin
449 } // namespace dart 452 } // namespace dart
450 453
451 #endif // defined(TARGET_OS_ANDROID) 454 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/directory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698