call[fs]cgi: Ensure exit handlers are not called in failing children.
[ashd.git] / src / callscgi.c
index af84a9a..85cc50a 100644 (file)
@@ -195,7 +195,7 @@ static void startlisten(void)
            close(i);
        execvp(*progspec, progspec);
        flog(LOG_ERR, "callscgi: %s: %s", *progspec, strerror(errno));
-       exit(127);
+       _exit(127);
     }
     close(fd);
 }
@@ -213,13 +213,13 @@ static void startnolisten(void)
            close(i);
        if((fd = open("/dev/null", O_RDONLY)) < 0) {
            flog(LOG_ERR, "/dev/null: %s", strerror(errno));
-           exit(127);
+           _exit(127);
        }
        dup2(fd, 0);
        close(fd);
        execvp(*progspec, progspec);
        flog(LOG_ERR, "callscgi: %s: %s", *progspec, strerror(errno));
-       exit(127);
+       _exit(127);
     }
 }
 
@@ -428,6 +428,8 @@ static void mkcgienv(struct hthead *req, struct charbuf *dst)
        bufaddenv(dst, "SERVER_NAME", "%s", h);
     if((h = getheader(req, "X-Ash-Server-Port")) != NULL)
        bufaddenv(dst, "SERVER_PORT", "%s", h);
+    if((h = getheader(req, "X-Ash-Remote-User")) != NULL)
+       bufaddenv(dst, "REMOTE_USER", "%s", h);
     if(((h = getheader(req, "X-Ash-Protocol")) != NULL) && !strcmp(h, "https"))
        bufaddenv(dst, "HTTPS", "on");
     if((h = getheader(req, "X-Ash-Address")) != NULL)