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

Unified Diff: runtime/bin/eventhandler_macos.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/eventhandler_linux.cc ('k') | runtime/bin/file_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 15700159f971c2bcd4478a60539cdd61a6049761..971ef1bd58a2dfe17769d8d569be2da671ae8b9c 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -63,7 +63,10 @@ static void RemoveFromKqueue(intptr_t kqueue_fd_, SocketData* sd) {
int status =
TEMP_FAILURE_RETRY(kevent(kqueue_fd_, events, changes, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed deleting events from kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed deleting events from kqueue: %s\n", error_message);
}
}
}
@@ -142,7 +145,10 @@ EventHandlerImplementation::EventHandlerImplementation()
EV_SET(&event, interrupt_fds_[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
int status = TEMP_FAILURE_RETRY(kevent(kqueue_fd_, &event, 1, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed adding interrupt fd to kqueue: %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("Failed adding interrupt fd to kqueue: %s\n", error_message);
}
}
@@ -337,7 +343,10 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events,
for (int i = 0; i < size; i++) {
// If flag EV_ERROR is set it indicates an error in kevent processing.
if ((events[i].flags & EV_ERROR) != 0) {
- FATAL1("kevent failed %s\n", strerror(events[i].data));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(events[i].data, error_message, kBufferSize);
+ FATAL1("kevent failed %s\n", error_message);
}
if (events[i].udata != NULL) {
SocketData* sd = reinterpret_cast<SocketData*>(events[i].udata);
@@ -405,7 +414,10 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) {
kMaxEvents,
timeout));
if (result == -1) {
- FATAL1("kevent failed %s\n", strerror(errno));
+ const int kBufferSize = 1024;
+ char error_message[kBufferSize];
+ strerror_r(errno, error_message, kBufferSize);
+ FATAL1("kevent failed %s\n", error_message);
} else {
handler_impl->HandleTimeout();
handler_impl->HandleEvents(events, result);
« no previous file with comments | « runtime/bin/eventhandler_linux.cc ('k') | runtime/bin/file_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698