#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.104 2005/07/08 16:18:39 alex Exp $";
/**
* @file
#include "parse.h"
#include "irc.h"
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
#include "rendezvous.h"
#endif
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 )) {
/* Initialize modules, part II: these functions are eventually
* called with already dropped privileges ... */
- Resolve_Init( );
Lists_Init( );
Channel_Init( );
Client_Init( );
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
Rendezvous_Init( );
#endif
Conn_Init( );
/* Alles abmelden */
Conn_Exit( );
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
Rendezvous_Exit( );
#endif
Client_Exit( );
strlcat( NGIRCd_VersionAddition, "TCPWRAP", sizeof NGIRCd_VersionAddition );
#endif
-#ifdef RENDEZVOUS
+#ifdef ZEROCONF
if( NGIRCd_VersionAddition[0] )
strlcat( NGIRCd_VersionAddition, "+", sizeof NGIRCd_VersionAddition );
- strlcat( NGIRCd_VersionAddition, "RENDEZVOUS", sizeof NGIRCd_VersionAddition );
+ strlcat( NGIRCd_VersionAddition, "ZEROCONF", sizeof NGIRCd_VersionAddition );
#endif
#ifdef IDENTAUTH
if( NGIRCd_VersionAddition[0] )
* 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 );
}