diff --git a/src/lib/nfs/Connection.cxx b/src/lib/nfs/Connection.cxx index e3dac5c81..9bcb241c2 100644 --- a/src/lib/nfs/Connection.cxx +++ b/src/lib/nfs/Connection.cxx @@ -237,6 +237,9 @@ NfsConnection::ScheduleSocket() if (!SocketMonitor::IsDefined()) { int _fd = nfs_get_fd(context); + if (_fd < 0) + return; + fd_set_cloexec(_fd, true); SocketMonitor::Open(_fd); }