mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-04 19:28:29 +00:00
Allow building without confstr
We use confstr to grab the default PATH value. If it's not there, just use a standard one with bin and sbin for /, /usr and /usr/local. Signed-off-by: Stéphane Graber <stgraber@ubuntu.com> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
1a2e58cf55
commit
511a6936c7
@ -301,7 +301,7 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
|
||||
AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
|
||||
|
||||
# Check for some syscalls functions
|
||||
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r])
|
||||
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr])
|
||||
|
||||
# Check for some functions
|
||||
AC_CHECK_LIB(util, openpty)
|
||||
|
@ -261,8 +261,6 @@ int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char** extra
|
||||
{
|
||||
if (policy == LXC_ATTACH_CLEAR_ENV) {
|
||||
char **extra_keep_store = NULL;
|
||||
char *path_env;
|
||||
size_t n;
|
||||
int path_kept = 0;
|
||||
|
||||
if (extra_keep) {
|
||||
@ -317,6 +315,10 @@ int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char** extra
|
||||
* that getenv("PATH") is never NULL and then die a
|
||||
* painful segfault death. */
|
||||
if (!path_kept) {
|
||||
#ifdef HAVE_CONFSTR
|
||||
size_t n;
|
||||
char *path_env;
|
||||
|
||||
n = confstr(_CS_PATH, NULL, 0);
|
||||
path_env = malloc(n);
|
||||
if (path_env) {
|
||||
@ -325,6 +327,9 @@ int lxc_attach_set_environment(enum lxc_attach_env_policy_t policy, char** extra
|
||||
free(path_env);
|
||||
}
|
||||
/* don't error out, this is just an extra service */
|
||||
#else
|
||||
setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user