lib/util: make sure panic action can attach a debugger on ubuntu (>=10.10)
authorStefan Metzmacher <metze@samba.org>
Tue, 4 Oct 2011 08:47:46 +0000 (10:47 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Oct 2011 08:57:56 +0000 (10:57 +0200)
By default user processes can't attach a debugger to a process.
So explicitly allow that for all child processes, before calling
the panic action script.

metze

lib/util/fault.c

index ed7684aaf37c66166bd3e3dc136038b2c1a76ab5..7fe081d28558cb1f1de397b431e674295e4227c9 100644 (file)
@@ -116,6 +116,13 @@ static void smb_panic_default(const char *why)
 {
        int result;
 
+#if defined(HAVE_PRCTL) && defined(PR_SET_PTRACER)
+       /*
+        * Make sure all children can attach a debugger.
+        */
+       prctl(PR_SET_PTRACER, getpid(), 0, 0, 0);
+#endif
+
        if (panic_action && *panic_action) {
                char pidstr[20];
                char cmdstring[200];