Make sure that errno of fopen() isn't overwritten by the logging code.

This commit is contained in:
Alexander Barton 2005-02-07 19:31:34 +00:00
parent 112102b10c
commit 8edeed8418
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: ngircd.c,v 1.88 2005/02/04 14:24:21 alex Exp $"; static char UNUSED id[] = "$Id: ngircd.c,v 1.89 2005/02/07 19:31:34 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -618,12 +618,12 @@ Pidfile_Create( LONG pid )
/* Pidfile configured? */ /* Pidfile configured? */
if( ! Conf_PidFile[0] ) return; if( ! Conf_PidFile[0] ) return;
pidf = fopen( Conf_PidFile, "w" );
#ifdef DEBUG #ifdef DEBUG
Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile ); Log( LOG_DEBUG, "Creating PID file (%s) ...", Conf_PidFile );
#endif #endif
pidf = fopen( Conf_PidFile, "w" );
if( ! pidf ) if( ! pidf )
{ {
Log( LOG_ERR, "Error writing PID file (%s): %s", Conf_PidFile, strerror( errno )); Log( LOG_ERR, "Error writing PID file (%s): %s", Conf_PidFile, strerror( errno ));