mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 23:08:40 +02:00
Exit rather than return if we forked in System().
This commit is contained in:
@@ -1666,7 +1666,9 @@ System(char const *cmd, int is_queued)
|
|||||||
pid_t kid;
|
pid_t kid;
|
||||||
int fd;
|
int fd;
|
||||||
int status;
|
int status;
|
||||||
|
int do_exit = 0;
|
||||||
if (is_queued && IsServerMode()) {
|
if (is_queued && IsServerMode()) {
|
||||||
|
do_exit = 1;
|
||||||
/* Server mode... redirect stdin and stdout to /dev/null */
|
/* Server mode... redirect stdin and stdout to /dev/null */
|
||||||
kid = fork();
|
kid = fork();
|
||||||
if (kid == (pid_t) -1) {
|
if (kid == (pid_t) -1) {
|
||||||
@@ -1696,6 +1698,11 @@ System(char const *cmd, int is_queued)
|
|||||||
}
|
}
|
||||||
/* This is the child process or original if we never forked */
|
/* This is the child process or original if we never forked */
|
||||||
r = system(cmd);
|
r = system(cmd);
|
||||||
|
if (do_exit) {
|
||||||
|
/* In the child process, so exit! */
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user