Mercurial > hg > mlmmj
changeset 52:e8b0cd47fe1e
mlmmj-recieve fork()
author | mmj |
---|---|
date | Wed, 28 Apr 2004 01:47:43 +1000 |
parents | 98952eec991d |
children | 5c0d2fceed82 |
files | src/mlmmj-process.c src/mlmmj-recieve.c |
diffstat | 2 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mlmmj-recieve.c Tue Apr 27 22:58:18 2004 +1000 +++ b/src/mlmmj-recieve.c Wed Apr 28 01:47:43 2004 +1000 @@ -34,8 +34,9 @@ { char *infilename = NULL, *listdir = NULL, *line = NULL; char *randomstr = random_str(); + char *mlmmjprocess, *argv0 = strdup(argv[0]); int fd, opt, noprocess = 0; - char *mlmmjprocess, *argv0 = strdup(argv[0]); + pid_t childpid; log_set_name(argv[0]); @@ -96,6 +97,19 @@ exit(EXIT_SUCCESS); } + /* + * Now we fork so we can exit with success since it could potentially + * take a long time for mlmmj-send to finish delivering the mails and + * returning, making it susceptible to getting a SIGKILL from the + * mailserver invoking mlmmj-recieve. + */ + childpid = fork(); + if(childpid < 0) + log_error(LOG_ARGS, "fork() failed! Proceeding anyway"); + + if(childpid) + exit(EXIT_SUCCESS); /* Parent says: "bye bye kids!"*/ + execlp(mlmmjprocess, mlmmjprocess, "-L", listdir, "-m", infilename, 0);