system/FileDescriptor: fix Duplicate result
dup2 returns new_fd on success, not 0
This commit is contained in:
parent
8348a1ec8f
commit
ad585e179f
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user