- int open_fd = open(device, O_RDONLY);
- if (open_fd < 0) {
- err(EX_NOINPUT, "Could not open keyboard event file");
+ fd_set all_inputs;
+ FD_ZERO(&all_inputs);
+ int maxfd = 0;
+ glob_t glob_result;
+ int glob_return = glob(device, GLOB_ERR | GLOB_NOSORT, NULL, &glob_result);
+ if (glob_return == GLOB_NOMATCH) {
+ errx(EX_NOINPUT, "Could not find keyboard event file(s): %s", device);
+ }
+ if (glob_return != 0) {
+ err(EX_NOINPUT, "Could not glob keyboard event file(s): %s", device);