diff --git a/lib/pager.c b/lib/pager.c index 04111bab7..4c0197f43 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)