| OLD | NEW |
| 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/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 uint8_t buffer[kBufferSize]; | 259 uint8_t buffer[kBufferSize]; |
| 260 while ((result = TEMP_FAILURE_RETRY( | 260 while ((result = TEMP_FAILURE_RETRY( |
| 261 read(old_fd, buffer, kBufferSize))) > 0) { | 261 read(old_fd, buffer, kBufferSize))) > 0) { |
| 262 int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result)); | 262 int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result)); |
| 263 if (wrote != result) { | 263 if (wrote != result) { |
| 264 result = -1; | 264 result = -1; |
| 265 break; | 265 break; |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 int e = errno; |
| 270 VOID_TEMP_FAILURE_RETRY(close(old_fd)); |
| 271 VOID_TEMP_FAILURE_RETRY(close(new_fd)); |
| 269 if (result < 0) { | 272 if (result < 0) { |
| 270 int e = errno; | |
| 271 VOID_TEMP_FAILURE_RETRY(close(old_fd)); | |
| 272 VOID_TEMP_FAILURE_RETRY(close(new_fd)); | |
| 273 VOID_NO_RETRY_EXPECTED(unlink(new_path)); | 273 VOID_NO_RETRY_EXPECTED(unlink(new_path)); |
| 274 errno = e; | 274 errno = e; |
| 275 return false; | 275 return false; |
| 276 } | 276 } |
| 277 return true; | 277 return true; |
| 278 } else if (type == kIsDirectory) { | 278 } else if (type == kIsDirectory) { |
| 279 errno = EISDIR; | 279 errno = EISDIR; |
| 280 } else { | 280 } else { |
| 281 errno = ENOENT; | 281 errno = ENOENT; |
| 282 } | 282 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 return (file_1_info.st_ino == file_2_info.st_ino && | 422 return (file_1_info.st_ino == file_2_info.st_ino && |
| 423 file_1_info.st_dev == file_2_info.st_dev) ? | 423 file_1_info.st_dev == file_2_info.st_dev) ? |
| 424 File::kIdentical : | 424 File::kIdentical : |
| 425 File::kDifferent; | 425 File::kDifferent; |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace bin | 428 } // namespace bin |
| 429 } // namespace dart | 429 } // namespace dart |
| 430 | 430 |
| 431 #endif // defined(TARGET_OS_ANDROID) | 431 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |