diff --git a/src/unix/stream.c b/src/unix/stream.c index e721aa1d..adb98c38 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -88,7 +88,12 @@ void uv__stream_init(uv_loop_t* loop, stream->write_queue_size = 0; if (loop->emfile_fd == -1) { - err = uv__open_cloexec("/", O_RDONLY); + err = uv__open_cloexec("/dev/null", O_RDONLY); + if (err < 0) + /* In the rare case that "/dev/null" isn't mounted open "/" + * instead. + */ + err = uv__open_cloexec("/", O_RDONLY); if (err >= 0) loop->emfile_fd = err; }