diff options
| author | torben | 2015-04-20 15:34:33 +0200 |
|---|---|---|
| committer | torben | 2015-04-20 15:34:33 +0200 |
| commit | a127c4a12af6501f3d98c34b6f31a930f78d0cfd (patch) | |
| tree | b2a8afc36adb8320fd1733d112c728cfb1334515 /testModule/systemd-preserve-process-marker.c | |
| parent | Refactoring. (diff) | |
| download | systemd-init-a127c4a12af6501f3d98c34b6f31a930f78d0cfd.tar.gz systemd-init-a127c4a12af6501f3d98c34b6f31a930f78d0cfd.tar.xz systemd-init-a127c4a12af6501f3d98c34b6f31a930f78d0cfd.zip | |
Determine minimal set of needed applications.
Diffstat (limited to 'testModule/systemd-preserve-process-marker.c')
| -rw-r--r-- | testModule/systemd-preserve-process-marker.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/testModule/systemd-preserve-process-marker.c b/testModule/systemd-preserve-process-marker.c index 2525bc5f..8f0fc108 100644 --- a/testModule/systemd-preserve-process-marker.c +++ b/testModule/systemd-preserve-process-marker.c @@ -17,13 +17,15 @@ void print_array(int argc, char *argv[]) { } int main(int argc, char *argv[]) { int count; - char **copy = malloc(sizeof(char *) * (argc-1)); + // Last item acts as null pointer. + char **copy = calloc(sizeof(char *), argc); + // Slice first given command line argument. for (count = 0; count < argc - 1; count++) copy[count] = strdup(argv[count + 1]); // Adding systemd indicator to preserve wrapped process during changing // root filesystem. We mark wrapper and child process. - copy[0][0] = '@'; argv[0][0] = '@'; + copy[0][0] = '@'; if (-1 == execvp(argv[1], copy)) { perror("Executing child process failed."); return -1; |
