Ignore SIGPIPE (non-inheritably) in dirplex, patplex, userplex and callscgi.
[ashd.git] / src / userplex.c
index 77f79d7..cfd313c 100644 (file)
@@ -43,7 +43,7 @@ struct user {
 
 static int ignore = 0;
 static char *mgroup = NULL;
-static char *dirname = "htpub";
+static char *dirname = NULL;
 static char **childspec;
 static uid_t minuid = 0;
 static struct user *users = NULL;
@@ -230,6 +230,10 @@ out:
     free(usrnm);
 }
 
+static void sighandler(int sig)
+{
+}
+
 static void usage(FILE *out)
 {
     fprintf(out, "usage: userplex [-hI] [-g GROUP] [-m MIN-UID] [-d PUB-DIR] [PROGRAM ARGS...]\n");
@@ -269,8 +273,9 @@ int main(int argc, char **argv)
     }
     if(optind < argc) {
        childspec = argv + optind;
-       dirname = NULL;
     } else {
+       if(dirname == NULL)
+           dirname = "htpub";
        bufinit(csbuf);
        bufadd(csbuf, "dirplex");
        bufadd(csbuf, dirname);
@@ -278,6 +283,7 @@ int main(int argc, char **argv)
        childspec = csbuf.b;
     }
     signal(SIGCHLD, SIG_IGN);
+    signal(SIGPIPE, sighandler);
     while(1) {
        if((fd = recvreq(0, &req)) < 0) {
            if(errno != 0)