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

Unified Diff: runtime/bin/file_linux.cc

Issue 22634003: Replaced strerror() calls with threadsafe strerror_r() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 8d5171a2e6612bb5ee3152a98d42d75a15c85755..1e9b49e73dbf9e8f792f9d791550ea38271c92b8 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -47,7 +47,9 @@ void File::Close() {
ASSERT(handle_->fd() >= 0);
int err = TEMP_FAILURE_RETRY(close(handle_->fd()));
if (err != 0) {
- Log::PrintErr("%s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ Log::PrintErr("%s\n", strerror_r(errno, error_buf, kBufferSize));
}
handle_->set_fd(kClosedFd);
}
@@ -308,7 +310,10 @@ File::StdioHandleType File::GetStdioHandleType(int fd) {
struct stat buf;
int result = fstat(fd, &buf);
if (result == -1) {
- FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno));
+ const int kBufferSize = 1024;
+ char error_buf[kBufferSize];
+ FATAL2("Failed stat on file descriptor %d: %s", fd,
+ strerror_r(errno, error_buf, kBufferSize));
}
if (S_ISCHR(buf.st_mode)) return kTerminal;
if (S_ISFIFO(buf.st_mode)) return kPipe;
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698