1
0
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:
Phil Sutter 2009-12-27 03:41:21 +01:00
parent ac8bb1489d
commit 43ee33a28d

View File

@ -93,7 +93,11 @@ static FILE* pid_popen(const char *command, const char *mode, pid_t *child) {
} else {
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);
_exit(EXIT_FAILURE); //child should die here, (normally execl will take care of this but it can fail)
}