attempt to catch errors and fail horribly

master
Drake 2 years ago
parent aca7e13435
commit 10e27df544

@ -1,3 +1,4 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -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();
}

Loading…
Cancel
Save