#include "portab.h"
-static char UNUSED id[] = "$Id: ngircd.c,v 1.97 2005/06/17 18:22:45 fw Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.102 2005/06/24 19:55:10 alex Exp $";
/**
* @file
main( int argc, const char *argv[] )
{
bool ok, configtest = false;
+ bool NGIRCd_NoDaemon = false;
int i;
size_t n;
umask( 0077 );
NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = false;
- NGIRCd_NoDaemon = NGIRCd_Passive = false;
+ NGIRCd_Passive = false;
#ifdef DEBUG
NGIRCd_Debug = false;
#endif
NGIRCd_SignalQuit = false;
/* Initialize modules, part I */
- Log_Init( );
+ Log_Init( ! NGIRCd_NoDaemon );
Conf_Init( );
if (!NGIRCd_Init( NGIRCd_NoDaemon )) {
* connected to ther controlling terminal. Use "--nodaemon"
* to disable this "daemon mode" (useful for debugging). */
if ( ! NGIRCd_NoDaemon ) {
- initialized = true;
pid = (long)fork( );
if( pid > 0 ) {
/* "Old" process: exit. */
}
/* Change working directory to home directory of the user
- * we are running as (when not running chroot()'ed!) */
+ * we are running as (only when running in daemon mode and not in chroot) */
if ( pwd ) {
- if( chdir( pwd->pw_dir ) == 0 )
- Log( LOG_DEBUG, "Changed working directory to \"%s\" ...", pwd->pw_dir );
- else
- Log( LOG_ERR, "Can't change working directory to \"%s\": %s",
- pwd->pw_dir, strerror( errno ));
+ if (!NGIRCd_NoDaemon ) {
+ if( chdir( pwd->pw_dir ) == 0 )
+ Log( LOG_DEBUG, "Changed working directory to \"%s\" ...", pwd->pw_dir );
+ else
+ Log( LOG_ERR, "Can't change working directory to \"%s\": %s",
+ pwd->pw_dir, strerror( errno ));
+ }
} else {
Log( LOG_ERR, "Can't get user informaton for UID %d!?", Conf_UID );
}