From ceceb4dffbeaa5b0e7418458a8cae2bf8a825ea1 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 24 Jan 2018 01:56:15 +0000 Subject: [PATCH] tests: robustify set_ptracer_any * tests/set_ptracer_any.c (main) [HAVE_PRCTL]: Provide fallback definitions for PR_SET_PTRACER and PR_SET_PTRACER_ANY constants, set all unused prctl arguments to 0. --- tests/set_ptracer_any.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/set_ptracer_any.c b/tests/set_ptracer_any.c index 3b4ea2cb..9d206259 100644 --- a/tests/set_ptracer_any.c +++ b/tests/set_ptracer_any.c @@ -37,10 +37,16 @@ int main(int argc, char **argv) { if (argc < 2) return 99; -#if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY - /* Turn off restrictions on tracing if applicable. If the options +#ifdef HAVE_PRCTL + /* Turn off restrictions on tracing if applicable. If the command * aren't available on this system, that's OK too. */ - (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); +# ifndef PR_SET_PTRACER +# define PR_SET_PTRACER 0x59616d61 +# endif +# ifndef PR_SET_PTRACER_ANY +# define PR_SET_PTRACER_ANY -1UL +# endif + (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); #endif if (write(1, "\n", 1) != 1) { perror("write"); -- 2.40.0