chiark / gitweb /
set cwd
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 3 May 2010 15:48:38 +0000 (16:48 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 3 May 2010 15:48:38 +0000 (16:48 +0100)
backends/innduct.c
doc/man/innduct.8

index afe94172da08bae01136d9bd335f96ad1b84cd48..b6984eaeb89cea752c54c0264e143bb174bb1f18 100644 (file)
@@ -356,7 +356,7 @@ static oop_rd_call peer_rd_err, peer_rd_ok;
 /* when changing defaults, remember to update the manpage */
 
 static const char *sitename, *remote_host;
-static const char *feedfile, *path_cli, *path_cli_dir;
+static const char *feedfile, *path_run, *path_cli, *path_cli_dir;
 static int quiet_multiple=0;
 static int become_daemon=1, try_filemon=1;
 static int try_stream=1;
@@ -3572,6 +3572,7 @@ static const Option innduct_options[]= {
 {0,"no-filemon",         0,       &try_filemon,              op_setint, 0   },
 {'C',"inndconf",         "F",     &inndconffile,             op_string      },
 {'P',"port",             "PORT",  &port,                     op_integer     },
+{0,"chdir",              "DIR",   &path_run,                 op_string      },
 {0,"cli",            "DIR/|PATH", &path_cli,                 op_string      },
 {0,"help",               0,       0,                         help           },
 
@@ -3669,7 +3670,10 @@ int main(int argc, char **argv) {
   if (max_bad_data_ratio < 0 || max_bad_data_ratio > 100)
     badusage("bad input data ratio must be between 0..100");
   max_bad_data_ratio *= 0.01;
-  
+
+  if (!path_run)
+    path_run= innconf->pathrun;
+
   if (!feedfile) {
     feedfile= xasprintf("%s/%s",innconf->pathoutgoing,sitename);
   } else if (!feedfile[0]) {
@@ -3679,7 +3683,7 @@ int main(int argc, char **argv) {
   }
 
   if (!path_cli) {
-    path_cli_dir= xasprintf("%s/innduct", innconf->pathrun);
+    path_cli_dir= "innduct";
   } else if (!path_cli[0] || !strcmp(path_cli,"none")) {
     path_cli= 0; /* ok, don't then */
   } else if (path_ends_slash(path_cli)) {
@@ -3699,6 +3703,9 @@ 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);
index 71c2afe0a5124948229ebc2537f2dfe6180efa77..a4c028f9a98922ea8243c02e62c49a72ed1ed479 100644 (file)
@@ -107,6 +107,18 @@ Read
 instead of the default
 .BR inn.conf .
 .TP
+.BI \-\-port= PORT
+Connect to port
+.I PORT
+at the remote site rather than to the NNTP port (119).
+.TP
+.BI \-\-chdir= pathrun
+Change directory to
+.IR pathrun
+at startup.  The default is
+.I pathrun
+from inn.conf.
+.TP
 .BR \-\-cli= \fICLI-DIR\fR / |\fICLI-PATH\fR| none
 Listen for control command line connections on
 .IB CLI-DIR / site
@@ -115,24 +127,17 @@ Listen for control command line connections on
 or
 .I CLI-PATH
 (if it doesn't).  See CONTROLLING INNDUCT, below.
-This option may be essential, if
-.I pathrun
-or
-.I site
-is too long, as there is a fairly short limit on the paths to AF_UNIX
+Note that there is a fairly short limit on the paths to AF_UNIX
 sockets.  If specified as
 .IR CLI-DIR \fB/\fR,
 the directory will be created with mode 700 if necessary.
 The default is
-.IB pathrun /innduct/
-which means to create that directory and listen on
+.B innduct/
+which means to create that directory in
+.I pathrun
+and listen on
 .RB \fIpathrun\fR /innduct/ \fIsite\fR.
 .TP
-.BI \-\-port= PORT
-Connect to port
-.I PORT
-at the remote site rather than to the NNTP port (119).
-.TP
 .BI \-\-help
 Just print a brief usage message and list of the options to stdout.
 .SH TUNING OPTIONS
@@ -328,8 +333,8 @@ corrupted; you just won't see some of the article stats.
 .LP
 innduct listens on an AF_UNIX socket, and provides a command-line
 interface which can be used to trigger various events and for
-debugging.  innduct listens on
-.IB pathrun /innduct/ site
+debugging.  innduct listens (by default on
+.IR pathrun \fB/innduct/\fR site )
 and when connected reads and writes lines (with unix line endings).
 The cli can most easily be accessed with a program like
 .I netcat-openbsd
@@ -431,6 +436,10 @@ two ascii-art diagrams in innduct.c for details of the protocol.)  Do
 not mess with the feedfile and other associated files, other than as
 explained here:
 .IX Header "FILES"
+.IP \fIpathrun\fR
+.IX Item "default directory"
+Default current working directory for innduct, and also default
+parent directory for the command line socket.
 .IP \fIpathoutgoing\fR/\fIsite\fR
 .IX Item "default feedfile"
 Default