view libpwon/forkoff.c @ 573:b22cc34b6fc9

loadtools/Makefile: removed provisions for special GTA02 AP build
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 02 Feb 2020 19:24:18 +0000
parents 41b3e010808d
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);
}