]> granicus.if.org Git - strace/commitdiff
tests: robustify set_ptracer_any
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 24 Jan 2018 01:56:15 +0000 (01:56 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 24 Jan 2018 01:56:15 +0000 (01:56 +0000)
* 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

index 3b4ea2cbbf5cff9a6079620fa4ae0ffdd3d9cf71..9d20625921dba9d66c265b973fb6019351e603a4 100644 (file)
@@ -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");