From c77452c8de7227230017ce6d96aa4e7c069c7b0f Mon Sep 17 00:00:00 2001 From: brian Date: Fri, 23 Jul 2010 09:11:47 +0000 Subject: Add a -S switch to override the default syslog pid file. This can be useful if syslogd's -P switch or a syslogd alternative is being used. MFC after: 3 weeks --- usr.sbin/newsyslog/newsyslog.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'usr.sbin/newsyslog/newsyslog.c') diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index f962482..7ba6cb8 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -206,6 +206,8 @@ char daytime[DAYTIME_LEN]; /* The current time in human readable form, * used for rotation-tracking messages. */ char hostname[MAXHOSTNAMELEN]; /* hostname */ +const char *path_syslogpid = _PATH_SYSLOGPID; + static struct cflist *get_worklist(char **files); static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, struct conf_entry *defconf_p, struct ilist *inclist); @@ -655,6 +657,9 @@ parse_args(int argc, char **argv) rotatereq++; requestor = strdup(optarg); break; + case 'S': + path_syslogpid = optarg; + break; case 'm': /* Used by OpenBSD for "monitor mode" */ default: usage(); @@ -747,7 +752,7 @@ usage(void) fprintf(stderr, "usage: newsyslog [-CFNnrsv] [-a directory] [-d directory] [-f config-file]\n" - " [-t timefmt ] [ [-R requestor] filename ... ]\n"); + " [-S pidfile] [-t timefmt ] [ [-R requestor] filename ... ]\n"); exit(1); } @@ -1355,7 +1360,7 @@ no_trimat: working->flags &= ~CE_SIGNALGROUP; } if (needroot) - working->pid_file = strdup(_PATH_SYSLOGPID); + working->pid_file = strdup(path_syslogpid); } /* -- cgit v1.1