From fd37e5d6cc43d8cbef35b4ff9a381866bd2eaf07 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 9 Mar 2003 00:30:25 +0000 Subject: if fopen fails, do not bork; rob@animoid-row.org --- sbin/mountd/mountd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sbin') 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); -- cgit v1.2.3