aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/nfs
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-08-31 19:07:50 +0200
committerMax Kellermann <max@duempel.org>2014-08-31 19:08:26 +0200
commit559a01f585bba2dee2d5093ccdf6d91f3b304ae8 (patch)
tree30799965339a4a1eb613280f7578000436477779 /src/lib/nfs
parentba8e3f11e26a1cebf9f10eea3613d440c52f1638 (diff)
downloadmpd-559a01f585bba2dee2d5093ccdf6d91f3b304ae8.tar.gz
mpd-559a01f585bba2dee2d5093ccdf6d91f3b304ae8.tar.xz
mpd-559a01f585bba2dee2d5093ccdf6d91f3b304ae8.zip
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).
Diffstat (limited to 'src/lib/nfs')
-rw-r--r--src/lib/nfs/Connection.cxx3
1 files changed, 3 insertions, 0 deletions
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);
}