Index: src/nntpcache.c --- src/nntpcache.c.orig 2004-04-11 13:43:56 +0200 +++ src/nntpcache.c 2006-03-06 20:21:29 +0100 @@ -1242,7 +1242,12 @@ Task = task_info_new (nc_master, "master"); watchInit(); drop_priv(ncUID, ncGID); - sprintf (PidFile, "%.127s.%.164s", con->pidFile, con->bindAddr); + + if (strchr(con->pidFile, (int)'/') != NULL) + sprintf (PidFile, "%.127s", con->pidFile); + else + sprintf (PidFile, "%.127s.%.164s", con->pidFile, con->bindAddr); + if (!(fh = fopen (PidFile, "w"))) logw (("couldn't open pid file '%s'", PidFile)); else @@ -1431,6 +1436,7 @@ char *config_file = con->configFile; char *access_file = con->accessFile; char *bindAddr = NULL; + char *pidFile = NULL; struct hostent *hp; enum task_state task; char *p = NULL; @@ -1451,7 +1457,7 @@ assert(task_desc[nc_last] == NULL); task = nc_master; - while ((c = getopt (argc, argv, "ef:hnb:rc:s")) != -1) + while ((c = getopt (argc, argv, "ef:hnb:p:rc:s")) != -1) switch (c) { case 'a': @@ -1491,6 +1497,9 @@ case 'b': bindAddr = Sstrdup(optarg); break; + case 'p': + pidFile = Sstrdup(optarg); + break; case 's': SwapWithChild = TRUE; break; @@ -1558,6 +1567,10 @@ if (con->bindAddr) free(con->bindAddr); con->bindAddr = Sstrdup(bindAddr); } + if (pidFile) { + if (con->pidFile) free(con->pidFile); + con->pidFile = Sstrdup(pidFile); + } if (chdir (con->configDir) == -1) { loge (("couldn't set cwd to %s", con->configDir));