Commit ad585e17 authored by arcnmx's avatar arcnmx

system/FileDescriptor: fix Duplicate result

dup2 returns new_fd on success, not 0
parent 8348a1ec
...@@ -178,7 +178,7 @@ public: ...@@ -178,7 +178,7 @@ public:
* Duplicate the file descriptor onto the given file descriptor. * Duplicate the file descriptor onto the given file descriptor.
*/ */
bool Duplicate(FileDescriptor new_fd) const noexcept { bool Duplicate(FileDescriptor new_fd) const noexcept {
return ::dup2(Get(), new_fd.Get()) == 0; return ::dup2(Get(), new_fd.Get()) != -1;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment