From 559a01f585bba2dee2d5093ccdf6d91f3b304ae8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 19:07:50 +0200 Subject: nfs/Connection: nfs_get_fd() can return -1 While reconnecting to the NFS server, the socket is -1, because there is no socket. Fixes a potential crash (assertion failure). --- src/lib/nfs/Connection.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib/nfs') 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); } -- cgit v1.2.3