diff --git a/ChangeLog b/ChangeLog index 00599dcd..1d2bb3eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,7 @@ v0.83.18 01-Apr-2006 Removed some debug logging. Fixed a small bug. Code cleanup. + Some changes to Launch code again. mbsebbs: Fixed logging of wrong file after upload. diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index af7195a3..69c2ba83 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -465,7 +465,7 @@ int msleep(int msecs) pid_t launch(char *cmd, char *opts, char *name, int tasktype) { static char buf[PATH_MAX]; - char *vector[16]; + static char *vector[16]; int i, rc = 0; pid_t pid = 0; @@ -473,7 +473,9 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype) Syslog('?', "Launch: can't execute %s, maximum tasks reached", cmd); return 0; } - memset(vector, 0, sizeof(vector)); +// memset(vector, 0, sizeof(vector)); + for (i = 0; i < 16; i++) + vector[i] = NULL; if (opts == NULL) snprintf(buf, PATH_MAX, "%s", cmd); @@ -485,11 +487,16 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype) while ((vector[i++] = strtok(NULL," \t\n")) && (i<16)); vector[15] = NULL; + for (i = 0; i < 16; i++) + if (vector[i]) + Syslog('l', "Launch: i=%d vector=\"%s\"", i, vector[i]); + if (file_exist(vector[0], X_OK)) { Syslog('?', "Launch: can't execute %s, command not found", vector[0]); return 0; } + Syslog('l', "Launch: b4 fork()"); switch (pid = fork()) { case -1: WriteError("$Launch: error, can't fork grandchild"); @@ -500,6 +507,7 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype) * before the main process sees it ever started. */ msleep(150); + Syslog('l', "Launch: child process"); /* From Paul Vixies cron: */ rc = setsid(); /* It doesn't seem to help */ @@ -530,6 +538,8 @@ pid_t launch(char *cmd, char *opts, char *name, int tasktype) break; } + Syslog('l', "Launch: parent process"); + /* * Add it to the tasklist. */