From 10e27df544b7bf73537e9c55ed03937e6547c903 Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Thu, 27 Jan 2022 00:44:57 -0500 Subject: [PATCH] attempt to catch errors and fail horribly --- src/exploit.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/exploit.c b/src/exploit.c index fcfffe5..abe0aad 100644 --- a/src/exploit.c +++ b/src/exploit.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -56,9 +57,18 @@ void clean() { void runAndClean(const char *env[], const char *arg[]) { int pid = fork(); - if (pid == 0) execve("/usr/bin/pkexec", arg, env); + if (pid == 0) { + int res = execve("/usr/bin/pkexec", arg, env); + /*if (res == -1) { + print("[Pwnkit] Failed to execute pkexec, or it returned an error; your system is most likely patched!"); + }*/ + } else { - waitpid(pid, NULL, 0); + int status; + waitpid(pid, &status, 0); + if (WEXITSTATUS(status) == 126) { + print("[Pwnkit] Failed to execute pkexec, or it returned an error; your system is most likely patched!"); + } print("[Pwnkit] Cleaning up.."); clean(); }