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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
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 29 matching lines...) Expand all Loading... |
40 Close(); | 40 Close(); |
41 } | 41 } |
42 delete handle_; | 42 delete handle_; |
43 } | 43 } |
44 | 44 |
45 | 45 |
46 void File::Close() { | 46 void File::Close() { |
47 ASSERT(handle_->fd() >= 0); | 47 ASSERT(handle_->fd() >= 0); |
48 int err = TEMP_FAILURE_RETRY(close(handle_->fd())); | 48 int err = TEMP_FAILURE_RETRY(close(handle_->fd())); |
49 if (err != 0) { | 49 if (err != 0) { |
50 const int kBufferSize = 1024; | 50 Log::PrintErr("%s\n", strerror(errno)); |
51 char error_message[kBufferSize]; | |
52 strerror_r(errno, error_message, kBufferSize); | |
53 Log::PrintErr("%s\n", error_message); | |
54 } | 51 } |
55 handle_->set_fd(kClosedFd); | 52 handle_->set_fd(kClosedFd); |
56 } | 53 } |
57 | 54 |
58 | 55 |
59 bool File::IsClosed() { | 56 bool File::IsClosed() { |
60 return handle_->fd() == kClosedFd; | 57 return handle_->fd() == kClosedFd; |
61 } | 58 } |
62 | 59 |
63 | 60 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return (file_1_info.st_ino == file_2_info.st_ino && | 344 return (file_1_info.st_ino == file_2_info.st_ino && |
348 file_1_info.st_dev == file_2_info.st_dev) ? | 345 file_1_info.st_dev == file_2_info.st_dev) ? |
349 File::kIdentical : | 346 File::kIdentical : |
350 File::kDifferent; | 347 File::kDifferent; |
351 } | 348 } |
352 | 349 |
353 } // namespace bin | 350 } // namespace bin |
354 } // namespace dart | 351 } // namespace dart |
355 | 352 |
356 #endif // defined(TARGET_OS_LINUX) | 353 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |