[libglnx] libcontainer: Set PATH when using execvp()



commit e684ef07f03dd563310788c90b3cdb00bac551eb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Sep 16 14:14:43 2015 -0400

    libcontainer: Set PATH when using execvp()
    
    Set PATH to something sane for a chroot'ed environment rather than
    relying on the user's PATH value.

 glnx-libcontainer.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/glnx-libcontainer.c b/glnx-libcontainer.c
index b4e93e7..8c0f340 100644
--- a/glnx-libcontainer.c
+++ b/glnx-libcontainer.c
@@ -281,6 +281,9 @@ glnx_libcontainer_run_chroot_private (const char  *dest,
     }
   else
     {
+      /* Set PATH to something sane. */
+      setenv ("PATH", "/usr/sbin:/usr/bin", 1);
+
       if (execvp (binary, argv) != 0)
         _perror_fatal ("execvp: ");
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]