clang detected the following false positive: sort.c:906:11: warning: The left operand of '<' is a garbage value if (pid < 0) ~~~ ^
src/sort.c: Add an assert indicating that pipe_fork is always called with tries > 0. This allows clang to deduce that 'pid' will always be set/is valid. Signed-off-by: Kovarththanan Rajaratnam <kovarththanan.rajarat...@gmail.com> --- src/sort.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/sort.c b/src/sort.c index 010930b..9c25723 100644 --- a/src/sort.c +++ b/src/sort.c @@ -874,6 +874,8 @@ pipe_fork (int pipefds[2], size_t tries) pid_t pid IF_LINT (= -1); struct cs_status cs; + assert(tries > 0); + if (pipe (pipefds) < 0) return -1; -- 1.6.3.3