From: Diego Nieto Cid <[email protected]>
fcntl with the F_DUPFD_CLOEXEC expect a third int argument
which would take whatever garbage is in the stack if not
provided.
---
main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 423d249..b34232f 100644
--- a/main.c
+++ b/main.c
@@ -427,7 +427,7 @@ establish_connection ()
if (fd < 0)
error (1, errno, "Cannot open connection");
- fd_dup = fcntl (fd, F_DUPFD_CLOEXEC);
+ fd_dup = fcntl (fd, F_DUPFD_CLOEXEC, fd);
if (fd_dup < 0)
error (1, errno, "fcntl(F_DUPFD_CLOEXEC)");
--
2.53.0