From: Karel Zak Date: Wed, 11 Oct 2017 12:42:49 +0000 (+0200) Subject: lib/pager: check open() return code [coverity scan] X-Git-Tag: v2.31~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1458c5c75013b65c23c024966d9f60aee49679cc;p=thirdparty%2Futil-linux.git lib/pager: check open() return code [coverity scan] Signed-off-by: Karel Zak --- 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)