Quoting Stéphane Graber (stgra...@ubuntu.com): > 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 <stgra...@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > --- > configure.ac | 2 +- > src/lxc/attach.c | 9 +++++++-- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/configure.ac b/configure.ac > index a0f0126..3a2a7f1 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -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]) > +AC_CHECK_FUNCS([setns pivot_root sethostname unshare confstr]) > > # Check for some functions > AC_CHECK_LIB(util, openpty) > diff --git a/src/lxc/attach.c b/src/lxc/attach.c > index 19fe61d..67eb0c7 100644 > --- a/src/lxc/attach.c > +++ b/src/lxc/attach.c > @@ -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 > } > } > > -- > 1.8.3.2 > > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite! > It's a free troubleshooting tool designed for production. > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk > _______________________________________________ > Lxc-devel mailing list > Lxc-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/lxc-devel ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel