diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-01 23:27:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-01 23:27:25 +0000 |
commit | b11bbb51235bd85172226ea037257b53ee9402da (patch) | |
tree | f6118a5419bc82550325ed0df2f3e50047f6ffbb /usr.sbin/rbootd/rbootd.c | |
parent | ea7f37b365f29a8552fe175609d79d58051b87c4 (diff) |
Use pidfile() instead of doing the equivalent thing by hand, and sometimes
forgetting to unlink the pid file at exit.
ok millert@ deraadt@
Diffstat (limited to 'usr.sbin/rbootd/rbootd.c')
-rw-r--r-- | usr.sbin/rbootd/rbootd.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/usr.sbin/rbootd/rbootd.c b/usr.sbin/rbootd/rbootd.c index b55afe53670..6492d0c15f6 100644 --- a/usr.sbin/rbootd/rbootd.c +++ b/usr.sbin/rbootd/rbootd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rbootd.c,v 1.8 2001/09/04 23:35:59 millert Exp $ */ +/* $OpenBSD: rbootd.c,v 1.9 2001/12/01 23:27:23 miod Exp $ */ /* $NetBSD: rbootd.c,v 1.5 1995/10/06 05:12:17 thorpej Exp $ */ /* @@ -55,7 +55,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$OpenBSD: rbootd.c,v 1.8 2001/09/04 23:35:59 millert Exp $"; +static char rcsid[] = "$OpenBSD: rbootd.c,v 1.9 2001/12/01 23:27:23 miod Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -174,20 +174,11 @@ main(argc, argv) } MyHost[MAXHOSTNAMELEN] = '\0'; - MyPid = getpid(); - /* * Write proc's pid to a file. */ - { - FILE *fp; - - if ((fp = fopen(PidFile, "w")) != NULL) { - (void) fprintf(fp, "%d\n", (int) MyPid); - (void) fclose(fp); - } else { - syslog(LOG_WARNING, "fopen: failed (%s)", PidFile); - } + if (pidfile(NULL) < 0) { + syslog(LOG_WARNING, "pidfile: failed"); } /* |