]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1484: Hangs at 100% CPU if /dev/null is not accessible
authorserassio <>
Sun, 26 Feb 2006 17:56:29 +0000 (17:56 +0000)
committerserassio <>
Sun, 26 Feb 2006 17:56:29 +0000 (17:56 +0000)
If the permissions of /dev/null is set incorrectly Squid hangs at 100% CPU
while starting helpers.

Forward port of 2.5 patch.

src/ipc.cc

index f7e325d0cdb1b7dfd28a454ca9fda37358c5be6b..70911465a362b452fa9b32cd957d725b12764d17 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipc.cc,v 1.41 2005/06/04 23:57:05 hno Exp $
+ * $Id: ipc.cc,v 1.42 2006/02/26 10:56:29 serassio Exp $
  *
  * DEBUG: section 54    Interprocess Communication
  * AUTHOR: Duane Wessels
@@ -341,11 +341,12 @@ ipcCreate(int type, const char *prog, const char *const args[], const char *name
      */
 
     do {
-        x = open(_PATH_DEVNULL, 0, 0444);
+        /* First make sure 0-2 is occupied by something. Gets cleaned up later */
+        x = dup(crfd);
+        assert(x > -1);
+    } while (x < 3 && x > -1);
 
-        if (x > -1)
-            commSetCloseOnExec(x);
-    } while (x < 3);
+    close(x);
 
     t1 = dup(crfd);