Merge pull request #72 from abucodonosor/master

Some cleanup

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson authored and GitHub committed 2017-03-28 18:43:32 +02:00
commit 06d3161ffe
2 files changed
+19 -4

No files matched your search

+9 -4
View File
@@ -155,7 +155,9 @@ static void networking(void)
return; return;
} }
/* Debian/Ubuntu/Busybox interfaces file */ /* Debian/Ubuntu/Busybox/RH/Suse */
if (fexist("/sbin/ifup")) {
/* interfaces file */
fp = fopen("/etc/network/interfaces", "r"); fp = fopen("/etc/network/interfaces", "r");
if (fp) { if (fp) {
int i = 0; int i = 0;
@@ -186,6 +188,7 @@ static void networking(void)
if (i) if (i)
return; return;
} }
}
/* Fall back to bring up at least loopback */ /* Fall back to bring up at least loopback */
ifconfig("lo", "127.0.0.1", "255.0.0.0", 1); ifconfig("lo", "127.0.0.1", "255.0.0.0", 1);
@@ -251,6 +254,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 +348,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
*/ */
+10
View File
@@ -36,6 +36,16 @@
#include <lite/lite.h> #include <lite/lite.h>
#include <uev/uev.h> #include <uev/uev.h>
/* just in case */
#ifndef _PATH_STDPATH
#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
#endif
#ifndef _PATH_VARRUN
#define _PATH_VARRUN "/var/run/"
#endif
#define CMD_SIZE 256 #define CMD_SIZE 256
#define LINE_SIZE 1024 #define LINE_SIZE 1024
#define BUF_SIZE 4096 #define BUF_SIZE 4096