Commit 7148e0b9 authored by Yoni Fogel's avatar Yoni Fogel

Refs Tokutek/ft-index#28 Fix compile failure

parent 1518fb17
...@@ -60,6 +60,7 @@ endif () ...@@ -60,6 +60,7 @@ endif ()
check_symbol_exists(O_DIRECT "fcntl.h" HAVE_O_DIRECT) check_symbol_exists(O_DIRECT "fcntl.h" HAVE_O_DIRECT)
check_symbol_exists(F_NOCACHE "fcntl.h" HAVE_F_NOCACHE) check_symbol_exists(F_NOCACHE "fcntl.h" HAVE_F_NOCACHE)
check_symbol_exists(MAP_ANONYMOUS "sys/mman.h" HAVE_MAP_ANONYMOUS) check_symbol_exists(MAP_ANONYMOUS "sys/mman.h" HAVE_MAP_ANONYMOUS)
check_symbol_exists(PR_SET_PTRACER "sys/prctl.h" HAVE_PR_SET_PTRACER)
include(CheckFunctionExists) include(CheckFunctionExists)
......
...@@ -107,9 +107,9 @@ run_gdb(pid_t parent_pid, const char *gdb_path) { ...@@ -107,9 +107,9 @@ run_gdb(pid_t parent_pid, const char *gdb_path) {
// Get pid and path to executable. // Get pid and path to executable.
int n; int n;
n = snprintf(pid_buf, sizeof(pid_buf), "%d", parent_pid); n = snprintf(pid_buf, sizeof(pid_buf), "%d", parent_pid);
paranoid_invariant(n >= 0 && n < (int)sizeof(pid_buf)); invariant(n >= 0 && n < (int)sizeof(pid_buf));
n = snprintf(exe_buf, sizeof(exe_buf), "/proc/%d/exe", parent_pid); n = snprintf(exe_buf, sizeof(exe_buf), "/proc/%d/exe", parent_pid);
paranoid_invariant(n >= 0 && n < (int)sizeof(exe_buf)); invariant(n >= 0 && n < (int)sizeof(exe_buf));
dup2(2, 1); // redirect output to stderr dup2(2, 1); // redirect output to stderr
// Arguments are not dynamic due to possible security holes. // Arguments are not dynamic due to possible security holes.
...@@ -177,7 +177,7 @@ intermediate_process(pid_t parent_pid, const char *gdb_path) { ...@@ -177,7 +177,7 @@ intermediate_process(pid_t parent_pid, const char *gdb_path) {
static void static void
spawn_gdb(const char *gdb_path) { spawn_gdb(const char *gdb_path) {
pid_t parent_pid = getpid(); pid_t parent_pid = getpid();
#if defined(PR_SET_PTRACER) #if defined(HAVE_PR_SET_PTRACER)
// On systems that require permission for the same user to ptrace, // On systems that require permission for the same user to ptrace,
// give permission for this process and (more importantly) all its children to debug this process. // give permission for this process and (more importantly) all its children to debug this process.
prctl(PR_SET_PTRACER, parent_pid, 0, 0, 0); prctl(PR_SET_PTRACER, parent_pid, 0, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment