Assert read return value in examples/input-method

This commit is contained in:
Drew DeVault 2018-10-12 09:35:19 -04:00
parent 4c28745c95
commit b99da405e7

View File

@ -1,4 +1,5 @@
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -390,7 +391,8 @@ int main(int argc, char **argv) {
} }
} else if (caught.data.fd == timer_fd) { } else if (caught.data.fd == timer_fd) {
uint64_t expirations; uint64_t expirations;
read(timer_fd, &expirations, sizeof(expirations)); ssize_t n = read(timer_fd, &expirations, sizeof(expirations));
assert(n >= 0);
handle_timer(); handle_timer();
} else { } else {
printf("Unknown source\n"); printf("Unknown source\n");