diff options
author | Max Kellermann <max@duempel.org> | 2014-08-31 19:07:50 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-08-31 19:08:26 +0200 |
commit | 559a01f585bba2dee2d5093ccdf6d91f3b304ae8 (patch) | |
tree | 30799965339a4a1eb613280f7578000436477779 /src/lib/nfs/Connection.cxx | |
parent | ba8e3f11e26a1cebf9f10eea3613d440c52f1638 (diff) | |
download | mpd-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/Connection.cxx')
-rw-r--r-- | src/lib/nfs/Connection.cxx | 3 |
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); } |