head 1.3; access; symbols OPENPKG_E1_MP_HEAD:1.3 OPENPKG_E1_MP:1.3 OPENPKG_CW_FP:1.2; locks; strict; comment @# @; 1.3 date 2005.07.25.07.23.30; author rse; state dead; branches; next 1.2; 1.2 date 2005.03.16.16.34.56; author thl; state Exp; branches; next 1.1; 1.1 date 2005.03.16.13.44.52; author thl; state Exp; branches; next ; desc @@ 1.3 log @upgrading package: ngircd 0.8.3 -> 0.9.0 @ text @Index: src/ngircd/ngircd.c --- src/ngircd/ngircd.c.orig 2005-01-26 23:09:33 +0100 +++ src/ngircd/ngircd.c 2005-03-16 13:15:05 +0100 @@@@ -77,6 +77,9 @@@@ #ifdef SNIFFER NGIRCd_Sniffer = FALSE; #endif +#ifdef PID_FILE + strlcpy( NGIRCd_PidFile, "/dev/null", sizeof( NGIRCd_PidFile )); +#endif strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile )); @@@@ -139,6 +142,19 @@@@ Show_Version( ); exit( 1 ); } +#ifdef PID_FILE + if( strcmp( argv[i], "--pidfile" ) == 0 ) + { + if( i + 1 < argc ) + { + /* Ok, there's an parameter left */ + strlcpy( NGIRCd_PidFile, argv[i + 1], sizeof( NGIRCd_PidFile )); + + /* next parameter */ + i++; ok = TRUE; + } + } +#endif } else if(( argv[i][0] == '-' ) && ( argv[i][1] != '-' )) { @@@@ -282,6 +298,21 @@@@ /* Child-Prozess initialisieren */ (VOID)setsid( ); +#ifdef PID_FILE + { + mode_t old_umask; + pid_t pid; + FILE *fp; + + old_umask = umask((mode_t) 0022); + pid = getpid(); + if ((fp = fopen(NGIRCd_PidFile, "w")) == NULL) + syslog(LOG_ERR, "cannot write PID file '%s'", NGIRCd_PidFile); + fprintf(fp, "%ld\n", (long)pid); + fclose(fp); + umask(old_umask); + } +#endif chdir( "/" ); } @@@@ -565,6 +596,9 @@@@ puts( " -s, --sniffer enable network sniffer and display all IRC traffic" ); #endif puts( " -t, --configtest read, validate and display configuration; then exit" ); +#ifdef PID_FILE + puts( " --pidfile write PID into file" ); +#endif puts( " --version output version information and exit" ); puts( " --help display this help and exit" ); } /* Show_Help */ Index: src/ngircd/ngircd.h --- src/ngircd/ngircd.h.orig 2002-12-26 17:48:14 +0100 +++ src/ngircd/ngircd.h 2005-03-16 13:15:05 +0100 @@@@ -45,6 +45,10 @@@@ GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ +#ifdef PID_FILE +GLOBAL CHAR NGIRCd_PidFile[FNAME_LEN]; /* PID file */ +#endif + GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ @ 1.2 log @fix wrong programming language ;-) and copy'n'paste bug @ text @@ 1.1 log @new package: ngircd 0.8.3 (Next Generation IRC Server) @ text @d9 1 a9 1 + NGIRCd_PidFile[0] = '/dev/null'; d47 1 a47 1 + syslog(LOG_ERR, "cannot write PID file '%s'", PID_FILE); @