summaryrefslogtreecommitdiff
blob: 4abdcccf9dcd594de6163f99dda2935271301508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <unistd.h>
#include <sys/signal.h>
#include <sys/wait.h>
#include <stdlib.h>

int main (int argc, char *argv[]) {
	pid_t pid;

	signal (SIGQUIT, SIG_IGN);
	signal (SIGTERM, SIG_IGN);
	setpgid (0, 0);

	pid=fork ();
	if (pid == 0) {
		int status;
		wait (&status);
		exit (WEXITSTATUS(status));
	}
	else {
		execv (argv[1], &argv[1]);
		exit (1);
	}

	return 0;
}