]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/pager: check open() return code [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 11 Oct 2017 12:42:49 +0000 (14:42 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Oct 2017 12:42:49 +0000 (14:42 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/pager.c

index 04111bab7a0dd5a5e9ac6f4c0bc2f50225f6906a..4c0197f43848b130b9e41c6ed6ff4d72ad123293 100644 (file)
@@ -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)