summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-09 00:30:25 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-09 00:30:25 +0000
commitfd37e5d6cc43d8cbef35b4ff9a381866bd2eaf07 (patch)
treec74ab0595d7d2bdcfda7a4552f2f9a57a43a13f0
parentf4a655ff8e00a1b9a0e8db742feddd4d98104a20 (diff)
if fopen fails, do not bork; rob@animoid-row.org
-rw-r--r--sbin/mountd/mountd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index b70e738af4b..74b675d7ad0 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.53 2003/01/05 22:41:36 deraadt Exp $ */
+/* $OpenBSD: mountd.c,v 1.54 2003/03/09 00:30:24 deraadt Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -283,8 +283,10 @@ main(int argc, char *argv[])
} else {
pidfile = fopen(_PATH_MOUNTDPID, "w");
}
- fprintf(pidfile, "%ld\n", (long)getpid());
- fclose(pidfile);
+ if (pidfile) {
+ fprintf(pidfile, "%ld\n", (long)getpid());
+ fclose(pidfile);
+ }
signal(SIGHUP, (void (*)(int)) new_exportlist);
signal(SIGTERM, (void (*)(int)) send_umntall);