commit:     cfded513cd9b7febe4b7cf39a80411e4303f0655
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Sat Feb 24 22:24:08 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Feb 24 22:24:08 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=cfded513

openrc-init: set a default path

The default path provided by the system if one isn't set only includes
"/bin:/usr/bin". This adds the default path setting from sysvinit.

 src/rc/openrc-init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c
index eb346f59..de570e56 100644
--- a/src/rc/openrc-init.c
+++ b/src/rc/openrc-init.c
@@ -35,6 +35,7 @@
 #include "rc-wtmp.h"
 #include "version.h"
 
+static const char *path_default = "/sbin:/usr/sbin:/bin:/usr/bin";
 static const char *rc_default_runlevel = "default";
 
 static pid_t do_openrc(const char *runlevel)
@@ -183,6 +184,9 @@ int main(int argc, char **argv)
        sigaction(SIGINT, &sa, NULL);
        reboot(RB_DISABLE_CAD);
 
+       /* set default path */
+       setenv("PATH", path_default, 1);
+
        if (! reexec)
                init(default_runlevel);
 

Reply via email to