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

Unified Diff: runtime/bin/eventhandler_macos.cc

Issue 12476021: Handle /dev/null on linux, as an closed device. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Apply same fix for mac Created 7 years, 9 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
Index: runtime/bin/eventhandler_macos.cc
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index fbced64683ed5af4894d8f780354962c58a50bcb..91c3bf70a1b2100aba3d591640a0310400f4fcc6 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -102,7 +102,15 @@ static void UpdateKqueue(intptr_t kqueue_fd_, SocketData* sd) {
int status =
TEMP_FAILURE_RETRY(kevent(kqueue_fd_, events, changes, NULL, 0, NULL));
if (status == -1) {
- FATAL1("Failed updating kqueue: %s\n", strerror(errno));
+ // kQueue does not accept the file descriptor. It could be due to
+ // already closed file descriptor, or unuspported devices, such
+ // as /dev/null. In such case, mark the file descriptor as closed,
+ // so dart will handle it accordingly.
+ sd->set_write_tracked_by_kqueue(false);
+ sd->set_read_tracked_by_kqueue(false);
+ sd->ShutdownRead();
+ sd->ShutdownWrite();
+ DartUtils::PostInt32(sd->port(), 1 << kCloseEvent);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698