comparison 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
comparison
equal deleted inserted replaced
570:fb3deb215cb0 571:41b3e010808d
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5
6 extern char bootctrl_pwon_cmd[];
7
8 static char shell_pathname[] = "/bin/sh";
9
10 void
11 fork_exec_pwon_cmd()
12 {
13 int i;
14
15 i = vfork();
16 if (i < 0) {
17 perror("vfork");
18 exit(1);
19 }
20 if (i)
21 return;
22 execl(shell_pathname, "sh", "-c", bootctrl_pwon_cmd, (char *) 0);
23 perror(shell_pathname);
24 _exit(1);
25 }