summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0005-nspawn-Use-execvpe-only-when-libc-supports-it.patch
blob: 85279d68c24154cc9776a67d3ac8b21d4d6aa956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From a7417c2e6950d55c22c1b0d15783898b8ff229ef Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 05:10:37 +0000
Subject: [PATCH 05/11] nspawn: Use execvpe only when libc supports it

Upstream-Status: Denied [no desire for uclibc support]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/nspawn/nspawn.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 0d8d199..b597edb 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -129,6 +129,8 @@ typedef enum Volatile {
         VOLATILE_STATE,
 } Volatile;
 
+#include "config.h"
+
 static char *arg_directory = NULL;
 static char *arg_template = NULL;
 static char *arg_user = NULL;
@@ -4257,7 +4259,12 @@ int main(int argc, char *argv[]) {
                                 a[0] = (char*) "/sbin/init";
                                 execve(a[0], a, env_use);
                         } else if (argc > optind)
+#ifdef HAVE_EXECVPE
                                 execvpe(argv[optind], argv + optind, env_use);
+#else
+                                environ = env_use;
+                                execvp(argv[optind], argv + optind);
+#endif /* HAVE_EXECVPE */
                         else {
                                 chdir(home ? home : "/root");
                                 execle("/bin/bash", "-bash", NULL, env_use);
-- 
2.1.4