diff options
Diffstat (limited to 'platform.c')
-rw-r--r-- | platform.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/platform.c b/platform.c index 1f68df3a6..ee3e06914 100644 --- a/platform.c +++ b/platform.c | |||
@@ -19,6 +19,9 @@ | |||
19 | #include "includes.h" | 19 | #include "includes.h" |
20 | 20 | ||
21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
22 | #if defined(HAVE_SYS_PRCTL_H) | ||
23 | #include <sys/prctl.h> /* For prctl() and PR_SET_DUMPABLE */ | ||
24 | #endif | ||
22 | 25 | ||
23 | #include <stdarg.h> | 26 | #include <stdarg.h> |
24 | #include <unistd.h> | 27 | #include <unistd.h> |
@@ -217,3 +220,14 @@ platform_sys_dir_uid(uid_t uid) | |||
217 | #endif | 220 | #endif |
218 | return 0; | 221 | return 0; |
219 | } | 222 | } |
223 | |||
224 | void | ||
225 | platform_disable_tracing(int strict) | ||
226 | { | ||
227 | #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) | ||
228 | /* Disable ptrace on Linux without sgid bit */ | ||
229 | if (prctl(PR_SET_DUMPABLE, 0) != 0) | ||
230 | if (strict) | ||
231 | fatal("unable to make the process undumpable"); | ||
232 | #endif | ||
233 | } | ||