getevent: print error message when failing to get event

For some reason we weren't saying what the error was here, which could
be useful. Also change the failure message slightly to distinguish
between failing to get inotify and evdev events.

Bug: 245989146
Test: m toolbox
Change-Id: I456aa53d008043ea2549024002f9b88ea8d2d2cf
This commit is contained in:
Harry Cutts 2024-04-04 14:59:04 +00:00
parent b8f9475fd7
commit 08686936b5

View file

@ -441,7 +441,7 @@ static int read_notify(const char *dirname, int nfd, int print_flags)
if(res < (int)sizeof(*event)) {
if(errno == EINTR)
return 0;
fprintf(stderr, "could not get event, %s\n", strerror(errno));
fprintf(stderr, "could not get inotify events, %s\n", strerror(errno));
return 1;
}
//printf("got %d bytes of event information\n", res);
@ -664,7 +664,7 @@ int getevent_main(int argc, char *argv[])
if(ufds[i].revents & POLLIN) {
res = read(ufds[i].fd, &event, sizeof(event));
if(res < (int)sizeof(event)) {
fprintf(stderr, "could not get event\n");
fprintf(stderr, "could not get evdev event, %s\n", strerror(errno));
return 1;
}
if(get_time) {