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

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

Issue 2616463004: Signal an error for File.lastModified on a directory (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_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) 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
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
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)
OLDNEW
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698