From ce75de225a983794585a30d66bf58dee21c3c739 Mon Sep 17 00:00:00 2001 From: hm Date: Mon, 19 Nov 2001 14:19:21 +0000 Subject: Close files only if the fp is != NULL. PR: bin/31913 Submitted by: Harald Hanche-Olsen Reviewed by: hm MFC after: 1 week --- usr.sbin/i4b/isdnd/exec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'usr.sbin/i4b') diff --git a/usr.sbin/i4b/isdnd/exec.c b/usr.sbin/i4b/isdnd/exec.c index 180b97ab..6c9ed62 100644 --- a/usr.sbin/i4b/isdnd/exec.c +++ b/usr.sbin/i4b/isdnd/exec.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. + * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,11 +27,9 @@ * exec.h - supplemental program/script execution * ---------------------------------------------- * - * $Id: exec.c,v 1.23 2000/10/09 12:53:29 hm Exp $ - * * $FreeBSD$ * - * last edit-date: [Wed Sep 27 09:39:22 2000] + * last edit-date: [Mon Nov 19 15:21:38 2001] * *---------------------------------------------------------------------------*/ @@ -147,11 +145,12 @@ exec_prog(char *prog, char **arglist) * 3. /var/log/isdnd.log (or similar, when used) */ close(isdnfd); - if(useacctfile) + + if(useacctfile && acctfp) fclose(acctfp); - if(uselogfile) + + if(uselogfile && logfp) fclose(logfp); - if(execvp(path,arglist) < 0 ) _exit(127); -- cgit v1.1