#include #include #include #include void print_array(int argc, char *argv[]) { // Helper function to print given array with given length. int i = 0; int j = 0; for (i = 0; i < argc; i ++) { j = 0; while(argv[i][j] != '\0') printf("%c", argv[i][j++]); printf(" "); } printf("\n"); } int main(int argc, char *argv[]) { int count; char **copy = malloc(sizeof(char *) * (argc-1)); 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] = '@'; if (-1 == execvp(argv[1], copy)) { perror("child process execve failed [%m]"); return -1; } }