aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_bsd.h
diff options
context:
space:
mode:
Diffstat (limited to 'executor/common_bsd.h')
-rw-r--r--executor/common_bsd.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/executor/common_bsd.h b/executor/common_bsd.h
index e0beac33f..683e7c140 100644
--- a/executor/common_bsd.h
+++ b/executor/common_bsd.h
@@ -18,11 +18,12 @@
#endif
#if SYZ_EXECUTOR || SYZ_USB
#include <dirent.h>
-static void setup_usb(void)
+
+static const char* setup_usb(void)
{
DIR* dir = opendir("/dev");
if (dir == NULL)
- fail("failed to open /dev");
+ return "failed to open /dev";
bool have_vhci = false;
struct dirent* ent = NULL;
@@ -33,14 +34,14 @@ static void setup_usb(void)
continue;
char path[1024];
snprintf(path, sizeof(path), "/dev/%s", ent->d_name);
- if (chmod(path, 0666))
- failmsg("failed to chmod vhci", "path=%s", path);
+ if (chmod(path, 0666)) {
+ closedir(dir);
+ return "failed to chmod /dev/vhci";
+ }
have_vhci = true;
}
- if (!have_vhci)
- fail("don't have any /dev/vhci devices");
-
closedir(dir);
+ return have_vhci ? NULL : "don't have any /dev/vhci devices";
}
#endif
@@ -48,11 +49,14 @@ static void setup_usb(void)
#include <fcntl.h>
#include <sys/fault.h>
#include <sys/stat.h>
-static void setup_fault(void)
+
+static const char* setup_fault(void)
{
if (chmod("/dev/fault", 0666))
- fail("failed to chmod /dev/fault");
+ return "failed to chmod /dev/fault";
+ return NULL;
}
+
static int inject_fault(int nth)
{
struct fault_ioc_enable en;
@@ -71,6 +75,7 @@ static int inject_fault(int nth)
return fd;
}
#endif
+
#if SYZ_EXECUTOR
static int fault_injected(int fd)
{