finit.c: set _PATH_STDPATH much earlier

This should allow us to run 'prog' without
     absolute paths.  Eg:

     run("/bin/foo"); -> run("foo");

     However we still need absolute PATH for
     checking since fexist() need full path right now.

Signed-off-by: crazy <crazy@frugalware.org>
This commit is contained in:
crazy committed 2017-03-28 13:21:18 +02:00
1 parent 67435d2034
commit a44daf20cb
1 file changed
+5 -3
+5 -3
View File
@@ -251,6 +251,11 @@ int main(int argc, char* argv[])
uev_init(&loop); uev_init(&loop);
ctx = &loop; ctx = &loop;
/*
* Set the PATH early to something sane
*/
setenv("PATH", _PATH_STDPATH, 1);
/* /*
* Mount base file system, kernel is assumed to run devtmpfs for /dev * Mount base file system, kernel is assumed to run devtmpfs for /dev
*/ */
@@ -340,9 +345,6 @@ int main(int argc, char* argv[])
/* Set hostname as soon as possible, for syslog et al. */ /* Set hostname as soon as possible, for syslog et al. */
set_hostname(&hostname); set_hostname(&hostname);
/* Set default PATH, for uid 0 */
setenv("PATH", _PATH_STDPATH, 1);
/* /*
* Mount filesystems * Mount filesystems
*/ */