From 2711e4c044bdbf9d1e3803d19c8f1b5899fe3bf9 Mon Sep 17 00:00:00 2001 From: zqmfb <267821100+angularbanjo@users.noreply.github.com> Date: Wed, 25 Mar 2026 18:30:56 -0400 Subject: [PATCH] Use libtorrent's fd_set_nonblock helper --- src/rpc/scgi.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpc/scgi.cc b/src/rpc/scgi.cc index 44c6cbb4..833c65c2 100644 --- a/src/rpc/scgi.cc +++ b/src/rpc/scgi.cc @@ -84,8 +84,7 @@ SCgi::open_named(const std::string& filename) { void SCgi::open_fd(int fd) { torrent::runtime::socket_manager()->open_event_or_throw(this, [&]() { - int flags = ::fcntl(fd, F_GETFL, 0); - if (flags == -1 || ::fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) + if (!torrent::fd_set_nonblock(fd)) throw torrent::resource_error("Could not set non-blocking on systemd fd: " + std::string(std::strerror(errno))); set_file_descriptor(fd);