Safeguarded dup2 and close sequence in getcmd
This commit is contained in:
parent
d4a726ad78
commit
e6844edbf1
|
@ -81,11 +81,13 @@ getcmd(Block *block, int sigval)
|
|||
case 0:
|
||||
close(ConnectionNumber(dpy));
|
||||
close(fd[0]);
|
||||
if (fd[1] != STDOUT_FILENO) {
|
||||
if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
|
||||
perror("getcmd - child - dup2");
|
||||
exit(1);
|
||||
}
|
||||
close(fd[1]);
|
||||
}
|
||||
if (sigval == NILL) {
|
||||
char *arg[] = { block->pathu, NULL };
|
||||
|
||||
|
|
Loading…
Reference in a new issue