From 69c85fa88eba53d9444119b726528243c0f56382 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 11 Jan 2019 15:59:51 -0500 Subject: [PATCH] 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 Reviewed-By: Ben Noordhuis --- src/unix/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/process.c b/src/unix/process.c index ea1f852d..b284308d 100644 --- a/src/unix/process.c +++ b/src/unix/process.c @@ -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); }