Jan Stary wrote: > Upon startup, apmd(8) opens /dev/apmctl like this: > > if ((ctl_fd = open(fname, O_RDWR | O_CLOEXEC)) == -1) { > if (errno != ENXIO && errno != ENOENT) > error("cannot open device file `%s'", fname); > } > > Why is it that we ignore ENXIO and ENOENT here? > apmd(8) seems to go on using the fd as if opening successfully.
There are quite a few checks for ctl_fd == -1 elsewhere, in which case apmd uses fake data, but a few are missing. And I'm not impressed with the idea in general.