| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 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 <f> 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 */
-
-
|