Use daemon() to deamonify ourselves.

This commit is contained in:
Bill Paul 1995-07-18 21:35:32 +00:00
parent 7f101baa9d
commit cef6b9bc3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9577

View File

@ -26,7 +26,7 @@ char copyright[] =
#ifndef lint
static char rcsid[] =
"@(#) $Header: /home/ncvs/src/usr.sbin/rarpd/rarpd.c,v 1.3 1995/04/02 01:35:54 wpaul Exp $ (LBL)";
"@(#) $Header: /home/ncvs/src/usr.sbin/rarpd/rarpd.c,v 1.4 1995/05/30 03:51:25 rgrimes Exp $ (LBL)";
#endif
@ -166,16 +166,11 @@ main(argc, argv)
else
init_one(ifname);
if (!fflag) {
pid = fork();
if (pid > 0)
/* Parent exits, leaving child in background. */
if (!fflag)
if (daemon(0,0)) {
perror("fork");
exit(0);
else if (pid == -1) {
syslog(LOG_ERR, "cannot fork");
exit(1);
}
}
rarp_loop();
}