Skip to content

Commit

Permalink
scrotExecApp: check for WIFEXITED first
Browse files Browse the repository at this point in the history
according to waitpid(3) manpage:

| This macro (WEXITSTATUS) should be employed only if WIFEXITED returned true.
  • Loading branch information
N-R-K committed May 12, 2023
1 parent 9c9ba63 commit fafced4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scrot.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ static void scrotExecApp(Imlib_Image image, struct tm *tm, char *filenameIM,

if (ret == -1)
warn("The child process could not be created");
else if (WEXITSTATUS(ret) == 127)
else if (WIFEXITED(ret) && WEXITSTATUS(ret) == 127)
warnx("scrot could not execute the command: %s", execStr);
free(execStr);
}
Expand Down

0 comments on commit fafced4

Please sign in to comment.