simple-init

A set of init binaries for linux
git clone git://depsterr.com/git/simple-init
Log | Files | Refs | README | LICENSE

commit 4203545efbfe2712f5fa30bb47c294580a97db36
parent 95005f5e4db9a5fdfdb8fd735200db656f92c132
Author: depsterr <depsterr@protonmail.com>
Date:   Sun, 31 May 2020 17:28:30 +0200

added needed includes and moved decleration of spawn_process

Diffstat:
Minitscripts/util.c | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/initscripts/util.c b/initscripts/util.c @@ -1,5 +1,6 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/wait.h> #include <fcntl.h> #include <unistd.h> @@ -8,6 +9,17 @@ #include <mntent.h> #include <stdio.h> +int spawn_process(char** argv) { + int child_pid; + if ((child_pid = fork()) == 0) { + setsid(); + execvp(argv[0], argv); + fprintf(stderr, "execvp: %s\n", argv[0]); + exit(1); + } + return child_pid; +} + void wait_for_children() { int status = 0; while(wait(&status) > 0) { @@ -22,17 +34,6 @@ void wait_for_children() { } } -int spawn_process(char** argv) { - int child_pid; - if ((child_pid = fork()) == 0) { - setsid(); - execvp(argv[0], argv); - fprintf(stderr, "execvp: %s\n", argv[0]); - exit(1); - } - return child_pid; -} - void make_path(char* path) { char ret = 0; char* dirpath = 0;