diff options
Diffstat (limited to 'executor/common_bsd.h')
| -rw-r--r-- | executor/common_bsd.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/executor/common_bsd.h b/executor/common_bsd.h index 82aef4211..070c512bf 100644 --- a/executor/common_bsd.h +++ b/executor/common_bsd.h @@ -17,10 +17,28 @@ #include "common_usb_netbsd.h" #endif #if SYZ_EXECUTOR || SYZ_USB +#include <dirent.h> static void setup_usb(void) { - if (chmod("/dev/vhci", 0666)) - fail("failed to chmod /dev/vhci"); + struct dirent* ent; + char path[1024]; + DIR* dir; + + dir = opendir("/dev"); + if (dir == NULL) + fail("failed to open /dev"); + + while ((ent = readdir(dir)) != NULL) { + if (ent->d_type != DT_CHR) + continue; + if (strncmp(ent->d_name, "vhci", 4)) + continue; + snprintf(path, sizeof(path), "/dev/%s", ent->d_name); + if (chmod(path, 0666)) + fail("failed to chmod %s", path); + } + + closedir(dir); } #endif |
