FreeCalypso > hg > freecalypso-tools
diff libpwon/forkoff.c @ 571:41b3e010808d
libpwon started, compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 02 Feb 2020 17:40:25 +0000 |
parents | |
children | cef70d53fc5e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libpwon/forkoff.c Sun Feb 02 17:40:25 2020 +0000 @@ -0,0 +1,25 @@ +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +extern char bootctrl_pwon_cmd[]; + +static char shell_pathname[] = "/bin/sh"; + +void +fork_exec_pwon_cmd() +{ + int i; + + i = vfork(); + if (i < 0) { + perror("vfork"); + exit(1); + } + if (i) + return; + execl(shell_pathname, "sh", "-c", bootctrl_pwon_cmd, (char *) 0); + perror(shell_pathname); + _exit(1); +}