Commit 4e113a70 authored by Max Kellermann's avatar Max Kellermann

lib/nfs/Connection: use class SocketDescriptor

parent 39f422de
...@@ -22,7 +22,7 @@ ...@@ -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() ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment