]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-attach: use execvp instead of execve
authorDavid Ward <david.ward@ll.mit.edu>
Thu, 3 May 2012 22:50:15 +0000 (00:50 +0200)
committerDaniel Lezcano <daniel.lezcano@free.fr>
Thu, 3 May 2012 22:50:15 +0000 (00:50 +0200)
execvp does not require specifying the full path to the executable
(e.g., "ls" instead of "/bin/ls"), making the operation of 'lxc-attach'
consistent with 'lxc-start' and 'lxc-execute'.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc_attach.c

index 3571b09b3ca64725f2f4e963d76fcfe6eb230b5e..4883327bd41293e30aa027b6aed78474b0372a7f 100644 (file)
@@ -89,7 +89,7 @@ Options :\n\
        .checker  = NULL,
 };
 
-int main(int argc, char *argv[], char *envp[])
+int main(int argc, char *argv[])
 {
        int ret;
        pid_t pid, init_pid;
@@ -212,7 +212,7 @@ int main(int argc, char *argv[], char *envp[])
                lxc_sync_fini(handler);
 
                if (my_args.argc) {
-                       execve(my_args.argv[0], my_args.argv, envp);
+                       execvp(my_args.argv[0], my_args.argv);
                        SYSERROR("failed to exec '%s'", my_args.argv[0]);
                        return -1;
                }
@@ -232,7 +232,7 @@ int main(int argc, char *argv[], char *envp[])
                                NULL,
                        };
 
-                       execve(args[0], args, envp);
+                       execvp(args[0], args);
                        SYSERROR("failed to exec '%s'", args[0]);
                        return -1;
                }