view 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 source

#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);
}