add lua plugin support
[project/uhttpd.git] / proc.c
diff --git a/proc.c b/proc.c
index 097a719..8680d01 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -168,7 +168,11 @@ struct env_var *uh_get_process_vars(struct client *cl, struct path_info *pi)
 
 static void proc_close_fds(struct client *cl)
 {
-       close(cl->dispatch.proc.r.sfd.fd.fd);
+       struct dispatch_proc *p = &cl->dispatch.proc;
+
+       close(p->r.sfd.fd.fd);
+       if (p->wrfd.fd >= 0)
+               close(p->wrfd.fd);
 }
 
 static void proc_handle_close(struct relay *r, int ret)
@@ -292,8 +296,8 @@ static int proc_data_send(struct client *cl, const char *data, int len)
        return retlen;
 }
 
-bool uh_create_process(struct client *cl, struct path_info *pi,
-                      void (*cb)(struct client *cl, struct path_info *pi))
+bool uh_create_process(struct client *cl, struct path_info *pi, const char *url,
+                      void (*cb)(struct client *cl, struct path_info *pi, const char *url))
 {
        struct dispatch *d = &cl->dispatch;
        struct dispatch_proc *proc = &d->proc;
@@ -327,7 +331,7 @@ bool uh_create_process(struct client *cl, struct path_info *pi,
                close(wfd[1]);
 
                uh_close_fds();
-               cb(cl, pi);
+               cb(cl, pi, url);
                exit(0);
        }