From 1458c5c75013b65c23c024966d9f60aee49679cc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 11 Oct 2017 14:42:49 +0200 Subject: [PATCH] lib/pager: check open() return code [coverity scan] Signed-off-by: Karel Zak --- lib/pager.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pager.c b/lib/pager.c index 04111bab7a..4c0197f438 100644 --- a/lib/pager.c +++ b/lib/pager.c @@ -192,6 +192,8 @@ static int has_command(const char *cmd) for(s = strtok(p, ":"); s; s = strtok(NULL, ":")) { int fd = open(s, O_RDONLY|O_CLOEXEC); + if (fd < 0) + continue; rc = faccessat(fd, cmd, X_OK, 0) == 0; close(fd); if (rc) -- 2.47.3