mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +00:00
check return type of dup() in exec.c
This commit is contained in:
parent
ac8bb1489d
commit
43ee33a28d
@ -93,7 +93,11 @@ static FILE* pid_popen(const char *command, const char *mode, pid_t *child) {
|
|||||||
} else {
|
} else {
|
||||||
close(1);
|
close(1);
|
||||||
}
|
}
|
||||||
dup(childend); //by dupping childend, the returned fd will have close-on-exec turned off
|
|
||||||
|
//by dupping childend, the returned fd will have close-on-exec turned off
|
||||||
|
if (dup(childend) == -1)
|
||||||
|
perror("dup()");
|
||||||
|
|
||||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||||
_exit(EXIT_FAILURE); //child should die here, (normally execl will take care of this but it can fail)
|
_exit(EXIT_FAILURE); //child should die here, (normally execl will take care of this but it can fail)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user