chiark / gitweb /
More sensible use of paths for feedfile and chdir
authorIan Jackson <ian@chiark.greenend.org.uk>
Mon, 3 May 2010 16:10:04 +0000 (17:10 +0100)
committerIan Jackson <ian@chiark.greenend.org.uk>
Mon, 3 May 2010 16:10:04 +0000 (17:10 +0100)
backends/innduct.c
doc/man/innduct.8

index b6984eaeb89cea752c54c0264e143bb174bb1f18..925b7fc9611a64970e7ad960e91c34878c75cede 100644 (file)
@@ -3674,13 +3674,12 @@ int main(int argc, char **argv) {
   if (!path_run)
     path_run= innconf->pathrun;
 
   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);
     feedfile= xasprintf("%s%s", feedfile, sitename);
-  }
+  if (feedfile[0] != '/')
+    feedfile= xasprintf("%s/%s", innconf->pathoutgoing, feedfile);
 
   if (!path_cli) {
     path_cli_dir= "innduct";
 
   if (!path_cli) {
     path_cli_dir= "innduct";
@@ -3703,9 +3702,6 @@ int main(int argc, char **argv) {
 
   /* set things up */
 
 
   /* 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);
   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");
 
   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();
   statemc_lock();
 
   init_signals();
index a4c028f9a98922ea8243c02e62c49a72ed1ed479..a294372dd022f3a2e877282789dcd1f435cf3d54 100644 (file)
@@ -71,15 +71,26 @@ feeding by looking in
 is the actual NNTP feeder program used by nntpsend.
 .SH GENERAL OPTIONS
 .TP
 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 /
 .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
 .TP
 .BR \-q | \-\-quiet-multiple
 Makes innduct silently exit (with status 0) if another innduct holds