diff options
author | Max Kellermann <max@musicpd.org> | 2018-08-20 17:23:14 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-08-20 17:23:14 +0200 |
commit | eef66dee04b34f3366328f9acc06b7c85b5ac656 (patch) | |
tree | 0c9cc6814c819c502a562a08f20cd9a7c61ee532 /src/system | |
parent | 7ad440ca1c3b5c8c1239efc699df37e731400938 (diff) |
system/FileDescriptor: pass FileDescriptor to CheckDuplicate()
Diffstat (limited to 'src/system')
-rw-r--r-- | src/system/FileDescriptor.cxx | 4 | ||||
-rw-r--r-- | src/system/FileDescriptor.hxx | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/system/FileDescriptor.cxx b/src/system/FileDescriptor.cxx index 3e75cc557..7717a7a62 100644 --- a/src/system/FileDescriptor.cxx +++ b/src/system/FileDescriptor.cxx @@ -205,9 +205,9 @@ FileDescriptor::DisableCloseOnExec() noexcept } bool -FileDescriptor::CheckDuplicate(int new_fd) noexcept +FileDescriptor::CheckDuplicate(FileDescriptor new_fd) noexcept { - if (fd == new_fd) { + if (*this == new_fd) { DisableCloseOnExec(); return true; } else diff --git a/src/system/FileDescriptor.hxx b/src/system/FileDescriptor.hxx index 7d1ee636b..c7203eb63 100644 --- a/src/system/FileDescriptor.hxx +++ b/src/system/FileDescriptor.hxx @@ -168,8 +168,8 @@ public: /** * Duplicate the file descriptor onto the given file descriptor. */ - bool Duplicate(int new_fd) const noexcept { - return ::dup2(Get(), new_fd) == 0; + bool Duplicate(FileDescriptor new_fd) const noexcept { + return ::dup2(Get(), new_fd.Get()) == 0; } /** @@ -178,7 +178,7 @@ public: * this method to inject file descriptors into a new child * process, to be used by a newly executed program. */ - bool CheckDuplicate(int new_fd) noexcept; + bool CheckDuplicate(FileDescriptor new_fd) noexcept; #endif #ifdef __linux__ |