From: Sami Kerola Date: Sat, 8 Aug 2020 19:02:01 +0000 (+0100) Subject: lib/pager: fix improper use of negative value [coverity scan] X-Git-Tag: v2.36.1~25 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e640ffda5b59ac9de048b39ff46dcdd88f6ad832;p=thirdparty%2Futil-linux.git lib/pager: fix improper use of negative value [coverity scan] The close(2) cannot accept a negative number. CID: 360777 Signed-off-by: Sami Kerola --- diff --git a/lib/pager.c b/lib/pager.c index b3cf6ee79b..747521e137 100644 --- a/lib/pager.c +++ b/lib/pager.c @@ -88,14 +88,14 @@ static int start_command(struct child_process *cmd) if (cmd->pid < 0) { if (need_in) close_pair(fdin); - else if (cmd->in) + else if (0 <= cmd->in) close(cmd->in); return -1; } if (need_in) close(fdin[0]); - else if (cmd->in) + else if (0 <= cmd->in) close(cmd->in); return 0; }