src/server/safs/cgi.c

changeset 171
af7e2d80dee6
parent 164
6f47eb624665
child 254
4784c14aa639
--- a/src/server/safs/cgi.c	Sat Feb 04 10:06:25 2017 +0100
+++ b/src/server/safs/cgi.c	Tue Feb 14 12:56:23 2017 +0100
@@ -39,7 +39,7 @@
 #include "../util/util.h"
 #include "../util/pblock.h"
 #include "../../ucx/string.h"
-
+#include "../daemon/netsite.h"
 #include "../util/io.h"
 
 #include "cgiutils.h"
@@ -126,7 +126,7 @@
             n += r;
         }
     }
-    close(cgip.in[1]);
+    system_close(cgip.in[1]);
     cgip.in[1] = -1;
     
     // read from child
@@ -238,13 +238,13 @@
         
         // we need to close this unused pipe
         // otherwise stdin cannot reach EOF
-        close(p->in[1]);
+        system_close(p->in[1]);
         
         // execute program
         exit(execve(script.ptr, argv, envp));
     } else {
         // parent  
-        close(p->out[1]);
+        system_close(p->out[1]);
         p->out[1] = -1;
     }
     
@@ -256,16 +256,16 @@
     waitpid(p->pid, &status, 0);
     
     if(p->in[0] != -1) {
-        close(p->in[0]);
+        system_close(p->in[0]);
     }
     if(p->in[1] != -1) {
-        close(p->in[1]);
+        system_close(p->in[1]);
     }
     if(p->out[0] != -1) {
-        close(p->out[0]);
+        system_close(p->out[0]);
     }
     if(p->out[1] != -1) {
-        close(p->out[1]);
+        system_close(p->out[1]);
     }
     
     return 0;
@@ -433,4 +433,4 @@
             return 1;
         }
     }
-}
\ No newline at end of file
+}

mercurial