lib/nfs/Connection: use class SocketDescriptor

This commit is contained in:
Max Kellermann
2017-08-10 17:29:03 +02:00
parent 39f422ded8
commit 4e113a7086

View File

@@ -22,7 +22,7 @@
#include "Lease.hxx" #include "Lease.hxx"
#include "Callback.hxx" #include "Callback.hxx"
#include "event/Loop.hxx" #include "event/Loop.hxx"
#include "system/fd_util.h" #include "net/SocketDescriptor.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
extern "C" { extern "C" {
@@ -408,12 +408,12 @@ NfsConnection::ScheduleSocket()
SocketMonitor::Steal(); SocketMonitor::Steal();
if (!SocketMonitor::IsDefined()) { if (!SocketMonitor::IsDefined()) {
int _fd = nfs_get_fd(context); SocketDescriptor _fd(nfs_get_fd(context));
if (_fd < 0) if (!_fd.IsDefined())
return; return;
fd_set_cloexec(_fd, true); _fd.EnableCloseOnExec();
SocketMonitor::Open(_fd); SocketMonitor::Open(_fd.Get());
} }
SocketMonitor::Schedule(libnfs_to_events(which_events) SocketMonitor::Schedule(libnfs_to_events(which_events)