version 1.5, 2007/06/08 18:00:04
|
version 1.7, 2008/06/20 17:20:34
|
|
|
#include <stdio.h> | #include <stdio.h> |
#include <grp.h> | #include <grp.h> |
#include "Defines.h" | #include "Defines.h" |
|
#include "Globals.h" |
#include "Fatal.h" | #include "Fatal.h" |
#include "Path.h" | #include "Path.h" |
#include "Log.h" | #include "Log.h" |
|
|
char sockStr[EXECUTOR_BUFFER_SIZE]; | char sockStr[EXECUTOR_BUFFER_SIZE]; |
char** execArgv; | char** execArgv; |
| |
|
globals.isChildProcess = 1; |
|
|
/* Build argument list, adding "--executor-socket <sock>" option if | /* Build argument list, adding "--executor-socket <sock>" option if |
* sock non-negative. | * sock non-negative. |
*/ | */ |
| |
execArgv = (char**)malloc(sizeof(char*) * (argc + 3)); |
if ((execArgv = (char**)malloc(sizeof(char*) * (argc + 3))) == NULL) |
|
{ |
|
Fatal(FL, "Memory allocation failed"); |
|
} |
memcpy(execArgv + 3, argv + 1, sizeof(char*) * argc); | memcpy(execArgv + 3, argv + 1, sizeof(char*) * argc); |
| |
sprintf(sockStr, "%d", sock); | sprintf(sockStr, "%d", sock); |
|
|
| |
/* If we are still here, the exec failed. */ | /* If we are still here, the exec failed. */ |
Fatal(FL, "failed to exec %s", path); | Fatal(FL, "failed to exec %s", path); |
|
|
exit(0); |
|
} | } |