system/FileDescriptor: fix Duplicate result

dup2 returns new_fd on success, not 0
This commit is contained in:
arcnmx 2020-10-19 12:15:34 -07:00
parent 8348a1ec8f
commit ad585e179f

View File

@ -178,7 +178,7 @@ public:
* Duplicate the file descriptor onto the given file descriptor.
*/
bool Duplicate(FileDescriptor new_fd) const noexcept {
return ::dup2(Get(), new_fd.Get()) == 0;
return ::dup2(Get(), new_fd.Get()) != -1;
}
/**