Close connection number to display in fork child

This commit is contained in:
Ashish Kumar Yadav 2020-07-07 01:31:38 +05:30
parent f73a8d5b2c
commit d97732daf9

View file

@ -50,6 +50,7 @@ buttonhandler(int signal, siginfo_t *si, void *ucontext)
perror("buttonhandler - fork");
exit(1);
case 0:
close(ConnectionNumber(dpy));
for (Block *current = blocks; current->pathu; current++) {
if (current->signal == signal) {
char button[] = { '0' + (si->si_value.sival_int & 0xff), '\0' };
@ -79,6 +80,7 @@ getcmd(Block *block, int *sigval)
perror("getcmd - fork");
exit(1);
case 0:
close(ConnectionNumber(dpy));
close(fd[0]);
if (dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
perror("getcmd - dup2");