Do not exit unconditionally if config file cannot be opened
ngircd will exit if the config file cannot be opened. While thats okay if ngircd starts up for the first time, it isn't when we are re-reading the config file after a /REHASH or SIGHUP.
This commit is contained in:
parent
ab1f48a346
commit
abb1abeb77
|
@ -12,6 +12,7 @@
|
|||
|
||||
ngIRCd HEAD
|
||||
|
||||
- Do not exit on SIGHUP or /REHASH if the config file cannot opened.
|
||||
- Add IPv6 support.
|
||||
- Install a LaunchDaemon script to start/stop ngIRCd on Mac OS X.
|
||||
- Implemented IRC commands INFO, SUMMON (dummy), and USERS (dummy) and
|
||||
|
@ -759,4 +760,4 @@ ngIRCd 0.0.1, 31.12.2001
|
|||
|
||||
|
||||
--
|
||||
$Id: ChangeLog,v 1.344 2008/02/26 22:05:42 fw Exp $
|
||||
$Id: ChangeLog,v 1.345 2008/03/18 20:12:47 fw Exp $
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.104 2008/02/26 22:04:17 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.105 2008/03/18 20:12:47 fw Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -57,7 +57,7 @@ static int New_Server_Idx;
|
|||
|
||||
|
||||
static void Set_Defaults PARAMS(( bool InitServers ));
|
||||
static void Read_Config PARAMS(( void ));
|
||||
static bool Read_Config PARAMS(( bool ngircd_starting ));
|
||||
static void Validate_Config PARAMS(( bool TestOnly, bool Rehash ));
|
||||
|
||||
static void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg ));
|
||||
|
@ -134,21 +134,21 @@ ports_parse(array *a, int Line, char *Arg)
|
|||
GLOBAL void
|
||||
Conf_Init( void )
|
||||
{
|
||||
Set_Defaults( true );
|
||||
Read_Config( );
|
||||
Read_Config( true );
|
||||
Validate_Config(false, false);
|
||||
} /* Config_Init */
|
||||
|
||||
|
||||
GLOBAL void
|
||||
GLOBAL bool
|
||||
Conf_Rehash( void )
|
||||
{
|
||||
Set_Defaults( false );
|
||||
Read_Config( );
|
||||
if (!Read_Config(false))
|
||||
return false;
|
||||
Validate_Config(false, true);
|
||||
|
||||
/* Update CLIENT structure of local server */
|
||||
Client_SetInfo(Client_ThisServer(), Conf_ServerInfo);
|
||||
return true;
|
||||
} /* Config_Rehash */
|
||||
|
||||
|
||||
|
@ -163,9 +163,8 @@ Conf_Test( void )
|
|||
char *topic;
|
||||
|
||||
Use_Log = false;
|
||||
Set_Defaults( true );
|
||||
|
||||
Read_Config( );
|
||||
Read_Config( true );
|
||||
Validate_Config(true, false);
|
||||
|
||||
/* If stdin and stdout ("you can read our nice message and we can
|
||||
|
@ -460,8 +459,8 @@ Set_Defaults( bool InitServers )
|
|||
} /* Set_Defaults */
|
||||
|
||||
|
||||
static void
|
||||
Read_Config( void )
|
||||
static bool
|
||||
Read_Config( bool ngircd_starting )
|
||||
{
|
||||
/* Read configuration file. */
|
||||
|
||||
|
@ -476,10 +475,14 @@ Read_Config( void )
|
|||
/* No configuration file found! */
|
||||
Config_Error( LOG_ALERT, "Can't read configuration \"%s\": %s",
|
||||
NGIRCd_ConfFile, strerror( errno ));
|
||||
if (!ngircd_starting)
|
||||
return false;
|
||||
Config_Error( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
Set_Defaults( ngircd_starting );
|
||||
|
||||
Config_Error( LOG_INFO, "Reading configuration from \"%s\" ...", NGIRCd_ConfFile );
|
||||
|
||||
/* Clean up server configuration structure: mark all already
|
||||
|
@ -626,6 +629,7 @@ Read_Config( void )
|
|||
exit( 1 );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} /* Read_Config */
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conf.h,v 1.48 2008/02/26 22:04:17 fw Exp $
|
||||
* $Id: conf.h,v 1.49 2008/03/18 20:12:47 fw Exp $
|
||||
*
|
||||
* Configuration management (header)
|
||||
*/
|
||||
|
@ -148,7 +148,7 @@ GLOBAL int Conf_MaxConnectionsIP;
|
|||
GLOBAL unsigned int Conf_MaxNickLength;
|
||||
|
||||
GLOBAL void Conf_Init PARAMS((void));
|
||||
GLOBAL void Conf_Rehash PARAMS((void));
|
||||
GLOBAL bool Conf_Rehash PARAMS((void));
|
||||
GLOBAL int Conf_Test PARAMS((void));
|
||||
|
||||
GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.118 2008/02/26 22:04:17 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.119 2008/03/18 20:12:47 fw Exp $";
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
@ -432,15 +432,16 @@ NGIRCd_Rehash( void )
|
|||
Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" );
|
||||
NGIRCd_SignalRehash = false;
|
||||
|
||||
/* Close down all listening sockets */
|
||||
Conn_ExitListeners( );
|
||||
|
||||
/* Remember old server name and nick name length */
|
||||
strlcpy( old_name, Conf_ServerName, sizeof old_name );
|
||||
old_nicklen = Conf_MaxNickLength;
|
||||
|
||||
/* Re-read configuration ... */
|
||||
Conf_Rehash( );
|
||||
if (!Conf_Rehash( ))
|
||||
return;
|
||||
|
||||
/* Close down all listening sockets */
|
||||
Conn_ExitListeners( );
|
||||
|
||||
/* Recover old server name and nick name length: these values can't
|
||||
* be changed during run-time */
|
||||
|
|
Loading…
Reference in New Issue