From c59255eee1ca87939343464651729776e833bb53 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 3 May 2010 17:10:04 +0100 Subject: [PATCH] More sensible use of paths for feedfile and chdir --- backends/innduct.c | 17 ++++++++--------- doc/man/innduct.8 | 27 +++++++++++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/backends/innduct.c b/backends/innduct.c index b6984ea..925b7fc 100644 --- a/backends/innduct.c +++ b/backends/innduct.c @@ -3674,13 +3674,12 @@ int main(int argc, char **argv) { if (!path_run) path_run= innconf->pathrun; - if (!feedfile) { - feedfile= xasprintf("%s/%s",innconf->pathoutgoing,sitename); - } else if (!feedfile[0]) { - badusage("feed filename, if specified, must be nonempty"); - } else if (path_ends_slash(feedfile)) { + if (!feedfile) feedfile= sitename; + if (!feedfile[0]) badusage("feed filename, if specified, must be nonempty"); + if (path_ends_slash(feedfile)) feedfile= xasprintf("%s%s", feedfile, sitename); - } + if (feedfile[0] != '/') + feedfile= xasprintf("%s/%s", innconf->pathoutgoing, feedfile); if (!path_cli) { path_cli_dir= "innduct"; @@ -3703,9 +3702,6 @@ int main(int argc, char **argv) { /* set things up */ - r= chdir(path_run); - if (r) sysdie("could not chdir to pathrun %s", path_run); - path_lock= xasprintf("%s_lock", feedfile); path_flushing= xasprintf("%s_flushing", feedfile); path_defer= xasprintf("%s_defer", feedfile); @@ -3745,6 +3741,9 @@ int main(int argc, char **argv) { self_pid= getpid(); if (self_pid==-1) sysdie("getpid"); + r= chdir(path_run); + if (r) sysdie("could not chdir to pathrun %s", path_run); + statemc_lock(); init_signals(); diff --git a/doc/man/innduct.8 b/doc/man/innduct.8 index a4c028f..a294372 100644 --- a/doc/man/innduct.8 +++ b/doc/man/innduct.8 @@ -71,15 +71,26 @@ feeding by looking in is the actual NNTP feeder program used by nntpsend. .SH GENERAL OPTIONS .TP -.BR \-f | \-\-feedfile= \fIfeedfile\fR -Specifies -.IR feedfile . -If the specified value ends in a +.BR \-f | \-\-feedfile= \fIpath\fR +Specifies the +.I feedfile +to read, and indirectly specifies the paths to +be used for various ancillary files (see FILES, below). +If +.I path +ends in a .B / -it is taken as a directory to use as if it were -.I pathoutgoing -and the actual feed file used is -.IR specified_feedfile / site . +it is taken as a directory to use, and the actual feed file used is +.IR path / site . +If +.I path +does not start with a +.BR / , +it is taken to be relative to +.IR pathoutgoing +from inn.conf. +The default is +.IR site . .TP .BR \-q | \-\-quiet-multiple Makes innduct silently exit (with status 0) if another innduct holds -- 2.30.2