Don't close handles more than once.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 31 May 2009 14:52:06 -0500
changeset 133 3004c3bd801c
parent 132 8b904ea53114
child 134 dc073c76a283
Don't close handles more than once.
nph-offload.c
--- a/nph-offload.c	Sun May 31 14:35:34 2009 -0500
+++ b/nph-offload.c	Sun May 31 14:52:06 2009 -0500
@@ -1301,13 +1301,17 @@
 
     #if GLISTENPORT
     if (GSocket != -1)
+    {
         close(GSocket);
+        GSocket = -1;
+    } // if
     #endif
 
-    fclose(stdin);
-    fclose(stdout);
-    fclose(stderr);
-    stdin = stderr = stdout = NULL;
+    if (stdin) fclose(stdin);
+    if (stdout) fclose(stdout);
+    if (stderr) fclose(stderr);
+    stdin = stdout = stderr = NULL;
+
     chdir("/");
     setsid();