unix: fix clang scan-build warning
When building libuv with clang scan-build, an "Assigned value is garbage or undefined" warning is emitted unless the return value of open() is verified to be >= 0. This commit fixes the warning. PR-URL: https://github.com/libuv/libuv/pull/2140 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
a833f921b8
commit
69c85fa88e
@ -315,7 +315,7 @@ static void uv__process_child_init(const uv_process_options_t* options,
|
||||
use_fd = open("/dev/null", fd == 0 ? O_RDONLY : O_RDWR);
|
||||
close_fd = use_fd;
|
||||
|
||||
if (use_fd == -1) {
|
||||
if (use_fd < 0) {
|
||||
uv__write_int(error_fd, UV__ERR(errno));
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user