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.37-rc1~416 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8df3f8ef8488894975a6d02b9c7e8e67ed4fad69;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; }