diff --git a/src/utils/filedescriptor.cpp b/src/utils/filedescriptor.cpp index b5e98c869c..820c2663dd 100644 --- a/src/utils/filedescriptor.cpp +++ b/src/utils/filedescriptor.cpp @@ -8,6 +8,7 @@ */ #include "filedescriptor.h" +#include #include #include @@ -58,7 +59,7 @@ int FileDescriptor::take() FileDescriptor FileDescriptor::duplicate() const { if (m_fd != -1) { - return FileDescriptor{dup(m_fd)}; + return FileDescriptor{fcntl(m_fd, F_DUPFD_CLOEXEC, 0)}; } else { return {}; }