]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1335: Can't dump core on Linux when started as root
authorserassio <>
Mon, 12 Sep 2005 03:08:52 +0000 (03:08 +0000)
committerserassio <>
Mon, 12 Sep 2005 03:08:52 +0000 (03:08 +0000)
Forward port of 2.5 patch.

configure.in
src/tools.cc

index 3198e43a35c284ff519186f8d8d397680ac99eee..5e016bca2f75f3c7cd1d67f2fb789afc43afc059 100644 (file)
@@ -3,7 +3,7 @@ dnl  Configuration input file for Squid
 dnl
 dnl  Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
 dnl
-dnl  $Id: configure.in,v 1.384 2005/08/28 10:45:32 serassio Exp $
+dnl  $Id: configure.in,v 1.385 2005/09/11 21:08:52 serassio Exp $
 dnl
 dnl
 dnl
@@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc])
 AC_CONFIG_AUX_DIR(cfgaux)
 AM_INIT_AUTOMAKE(squid, 3.0-PRE3-CVS)
 AM_CONFIG_HEADER(include/autoconf.h)
-AC_REVISION($Revision: 1.384 $)dnl
+AC_REVISION($Revision: 1.385 $)dnl
 AC_PREFIX_DEFAULT(/usr/local/squid)
 AM_MAINTAINER_MODE
 
@@ -1692,6 +1692,7 @@ AC_CHECK_HEADERS( \
        sys/file.h \
        sys/ioctl.h \
        sys/param.h \
+       sys/prctl.h \
        sys/msg.h \
        sys/resource.h \
        sys/select.h\
@@ -2223,6 +2224,7 @@ AC_CHECK_FUNCS(\
        mktime \
        mstats \
        poll \
+       prctl \
        pthread_attr_setschedparam \
        pthread_attr_setscope \
        pthread_setschedparam \
index e5488c5cd953112ea7f57f5b5e6cf7e927fe35bf..5147d2928e237f5aa1c9a5280921d344b23aa3c6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.260 2005/09/03 11:53:32 serassio Exp $
+ * $Id: tools.cc,v 1.261 2005/09/11 21:08:53 serassio Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
 #include "SwapDir.h"
 #include "fde.h"
 
+#if HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
+
 #define DEAD_MSG "\
 The Squid Cache (version %s) died.\n\
 \n\
@@ -700,6 +704,12 @@ leave_suid(void)
     if (setuid(Config2.effectiveUserID) < 0)
         debug(50, 0) ("ALERT: setuid: %s\n", xstrerror());
 
+#endif
+#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
+    /* Set Linux DUMPABLE flag */
+    if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
+        debug(50, 0) ("ALERT: prctl: %s\n", xstrerror());
+
 #endif
 }
 
@@ -715,6 +725,13 @@ enter_suid(void)
 
     setuid(0);
 #endif
+#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
+    /* Set Linux DUMPABLE flag */
+
+    if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
+        debug(50, 0) ("ALERT: prctl: %s\n", xstrerror());
+
+#endif
 }
 
 /* Give up the posibility to gain privilegies.
@@ -739,6 +756,12 @@ no_suid(void)
     if (setuid(uid) < 0)
         debug(50, 1) ("no_suid: setuid: %s\n", xstrerror());
 
+#endif
+#if HAVE_PRCTL && defined(PR_SET_DUMPABLE)
+    /* Set Linux DUMPABLE flag */
+    if (Config.coredump_dir && prctl(PR_SET_DUMPABLE, 1) != 0)
+        debug(50, 0) ("ALERT: prctl: %s\n", xstrerror());
+
 #endif
 }