From: Niclas Zeising Date: Mon, 10 Aug 2020 21:24:34 +0000 (+0200) Subject: tests: Disable attach debugger on FreeBSD X-Git-Tag: libevdev-1.9.901~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0af8c4054d44e186c6440f13d7f547532821ccae;p=platform%2Fupstream%2Flibevdev.git tests: Disable attach debugger on FreeBSD Disable attaching a debugger on FreeBSD, since FreeBSD lacks support for PTRACE_ATTACH. Signed-off-by: Niclas Zeising --- diff --git a/test/test-main.c b/test/test-main.c index 769d548..3763993 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -38,8 +38,13 @@ static int is_debugger_attached(void) { + int rc = 1; + /* + * FreeBSD does not support PTRACE_ATTACH, disable attaching a debugger + * on FreeBSD by skipping the rest of the function and just return 1. + */ +#ifndef __FreeBSD__ int status; - int rc; int pid = fork(); if (pid == -1) @@ -52,14 +57,14 @@ is_debugger_attached(void) ptrace(PTRACE_CONT, NULL, NULL); ptrace(PTRACE_DETACH, ppid, NULL, NULL); rc = 0; - } else - rc = 1; + } _exit(rc); } else { waitpid(pid, &status, 0); rc = WEXITSTATUS(status); } +#endif /* !__FreeBSD__ */ return rc; }