|
|
@ -265,7 +265,6 @@ int pressBufferRemove (struct pressed_buffer *pb, unsigned short key) |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -283,14 +282,18 @@ void die (void) |
|
|
|
|
|
|
|
|
|
|
|
void execCommand (const char *path) |
|
|
|
void execCommand (const char *path) |
|
|
|
{ |
|
|
|
{ |
|
|
|
pid_t child_pid = fork(); |
|
|
|
switch (fork()) { |
|
|
|
if (child_pid == -1) die(); |
|
|
|
case -1: |
|
|
|
// TODO: communication between parent and child about process status/errors/etc
|
|
|
|
fprintf(stderr, "Could not fork: %s", strerror(errno)); |
|
|
|
if (!child_pid) { |
|
|
|
break; |
|
|
|
|
|
|
|
case 0: |
|
|
|
/* we are the child */ |
|
|
|
/* we are the child */ |
|
|
|
int ret = 0; |
|
|
|
if(execl(path, path, (char *) NULL) != 0) |
|
|
|
ret = execl(path, path, (char *) NULL); |
|
|
|
/* execl only returns if an error occured, so we exit
|
|
|
|
if (ret != 0) |
|
|
|
* otherwise we duplicate the process */ |
|
|
|
exit(-1); |
|
|
|
exit(-1); |
|
|
|
|
|
|
|
/* we shouldn't be here */ |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: communication between parent and child about process status/errors/etc
|
|
|
|
} |
|
|
|
} |
|
|
|