summaryrefslogtreecommitdiffstats
path: root/testModule/systemd-preserve-process-marker.c
diff options
context:
space:
mode:
authortorben2015-04-20 15:34:33 +0200
committertorben2015-04-20 15:34:33 +0200
commita127c4a12af6501f3d98c34b6f31a930f78d0cfd (patch)
treeb2a8afc36adb8320fd1733d112c728cfb1334515 /testModule/systemd-preserve-process-marker.c
parentRefactoring. (diff)
downloadsystemd-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.c6
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;