diff --git a/Makefile b/Makefile index 8baffb83..9b56c52e 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,7 @@ LIBS = all: finit finit-mod finit-mdv -finit: finit.o - $(LD) $(LDFLAGS) -o $@ $+ $(LIBS) - strip $@ - -finit-mod: finit-mod.o - $(LD) $(LDFLAGS) -o $@ $+ $(LIBS) - strip $@ - -finit-mdv: finit-mdv.o +%: %.o $(LD) $(LDFLAGS) -o $@ $+ $(LIBS) strip $@ diff --git a/finit-mod.c b/finit-mod.c index 5df58148..fe204a85 100644 --- a/finit-mod.c +++ b/finit-mod.c @@ -27,7 +27,9 @@ THE SOFTWARE. Changelog from the original Eeepc fastinit: - Use mknod() instead of close(creat()) call to create empty file - +- Fix random seed initialization +- Don't try to handle signal 0 +- Implement makepath() to avoid system("mkdir -p") */ @@ -61,6 +63,23 @@ Changelog from the original Eeepc fastinit: #define touch(x) mknod((x), S_IFREG|0644, 0) +int makepath(char *p) +{ + char *x, path[PATH_MAX]; + int ret; + + x = path; + + do { + do { *x++ = *p++; } while (*p && *p != '/'); + ret = mkdir(path, 0777); + } while (*p && (*p != '/' || *(p + 1))); /* ignore trailing slash */ + + return ret; +} + + + void shutdown(int); void signal_handler(int); void chld_handler(int); @@ -145,8 +164,8 @@ int main() /* * Network stuff */ - system("mkdir -p /dev/shm/network"); - system("mkdir -p /dev/shm/resolvconf/interface"); + makepath("/dev/shm/network"); + makepath("/dev/shm/resolvconf/interface"); if ((dir = opendir("/etc/resolvconf/run/interface")) != NULL) { while ((d = readdir(dir)) != NULL) {