blob: 55a0088c65ed7a6abae081b4b73eae1a236bbdde [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 05:10:37 +0000
4Subject: [PATCH 05/11] nspawn: Use execvpe only when libc supports it
5
6Upstream-Status: Denied [no desire for uclibc support]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 src/nspawn/nspawn.c | 7 +++++++
11 1 file changed, 7 insertions(+)
12
13Index: git/src/nspawn/nspawn.c
14===================================================================
15--- git.orig/src/nspawn/nspawn.c
16+++ git/src/nspawn/nspawn.c
17@@ -143,6 +143,8 @@ typedef struct CustomMount {
18 char **lower;
19 } CustomMount;
20
21+#include "config.h"
22+
23 static char *arg_directory = NULL;
24 static char *arg_template = NULL;
25 static char *arg_user = NULL;
26@@ -4238,7 +4240,12 @@ static int inner_child(
27 a[0] = (char*) "/sbin/init";
28 execve(a[0], a, env_use);
29 } else if (argc > optind)
30+#ifdef HAVE_EXECVPE
31 execvpe(argv[optind], argv + optind, env_use);
32+#else
33+ environ = env_use;
34+ execvp(argv[optind], argv + optind);
35+#endif /* HAVE_EXECVPE */
36 else {
37 chdir(home ? home : "/root");
38 execle("/bin/bash", "-bash", NULL, env_use);