fd_util: don't call fd_set_nonblock() if open() has failed

This fixes an assertion failure.
This commit is contained in:
Max Kellermann 2009-11-11 14:30:38 +01:00
parent 9d1a34e30b
commit 96204ea3dc

View File

@ -114,7 +114,8 @@ open_cloexec(const char *path_fs, int flags, int mode)
#endif
fd = open(path_fs, flags, mode);
fd_set_cloexec(fd, true);
if (fd >= 0)
fd_set_cloexec(fd, true);
return fd;
}