| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 data[kSize] = st.st_size; | 378 data[kSize] = st.st_size; |
| 379 } else { | 379 } else { |
| 380 data[kType] = kDoesNotExist; | 380 data[kType] = kDoesNotExist; |
| 381 } | 381 } |
| 382 } | 382 } |
| 383 | 383 |
| 384 | 384 |
| 385 time_t File::LastModified(const char* name) { | 385 time_t File::LastModified(const char* name) { |
| 386 struct stat st; | 386 struct stat st; |
| 387 if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { | 387 if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) { |
| 388 // Signal an error if it's a directory. |
| 389 if (S_ISDIR(st.st_mode)) { |
| 390 errno = EISDIR; |
| 391 return -1; |
| 392 } |
| 393 // Otherwise assume the caller knows what it's doing. |
| 388 return st.st_mtime; | 394 return st.st_mtime; |
| 389 } | 395 } |
| 390 return -1; | 396 return -1; |
| 391 } | 397 } |
| 392 | 398 |
| 393 | 399 |
| 394 const char* File::LinkTarget(const char* pathname) { | 400 const char* File::LinkTarget(const char* pathname) { |
| 395 struct stat link_stats; | 401 struct stat link_stats; |
| 396 if (lstat(pathname, &link_stats) != 0) { | 402 if (lstat(pathname, &link_stats) != 0) { |
| 397 return NULL; | 403 return NULL; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 return ((file_1_info.st_ino == file_2_info.st_ino) && | 513 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 508 (file_1_info.st_dev == file_2_info.st_dev)) | 514 (file_1_info.st_dev == file_2_info.st_dev)) |
| 509 ? File::kIdentical | 515 ? File::kIdentical |
| 510 : File::kDifferent; | 516 : File::kDifferent; |
| 511 } | 517 } |
| 512 | 518 |
| 513 } // namespace bin | 519 } // namespace bin |
| 514 } // namespace dart | 520 } // namespace dart |
| 515 | 521 |
| 516 #endif // defined(TARGET_OS_FUCHSIA) | 522 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |