lib/pager: check open() return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2017-10-11 14:42:49 +02:00
parent 4bb91e84ff
commit 1458c5c750
1 changed files with 2 additions and 0 deletions

View 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)