libsysprof-capture: fix set_fd_blocking()

It was missing an include for the define and the variable was flat out
wrong when porting.

Fixes: #124
This commit is contained in:
Christian Hergert
2024-08-22 08:33:34 -07:00
parent 3ab494539e
commit 10217bb0e2

View File

@ -58,6 +58,7 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <pthread.h>
#ifdef __linux__
@ -140,7 +141,7 @@ set_fd_blocking (int fd)
{
#ifdef F_GETFL
long fcntl_flags;
fcntl_flags = fcntl (peer_fd, F_GETFL);
fcntl_flags = fcntl (fd, F_GETFL);
if (fcntl_flags == -1)
return false;
@ -151,7 +152,7 @@ set_fd_blocking (int fd)
fcntl_flags &= ~O_NDELAY;
#endif
if (fcntl (peer_fd, F_SETFL, fcntl_flags) == -1)
if (fcntl (fd, F_SETFL, fcntl_flags) == -1)
return false;
return true;