diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-10-12 09:35:19 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-10-12 09:35:19 -0400 |
commit | b99da405e7bc46006ab04c418e445387abfc1a5f (patch) | |
tree | 2523f8a8ff5755234d8345b6035ae400e8d6bff9 /examples | |
parent | 4c28745c95688fcee9b70ad746faeb91aca26298 (diff) |
Assert read return value in examples/input-method
Diffstat (limited to 'examples')
-rw-r--r-- | examples/input-method.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/input-method.c b/examples/input-method.c index 9c2d5524..3e485d1c 100644 --- a/examples/input-method.c +++ b/examples/input-method.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include <assert.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -390,7 +391,8 @@ int main(int argc, char **argv) { } } else if (caught.data.fd == timer_fd) { uint64_t expirations; - read(timer_fd, &expirations, sizeof(expirations)); + ssize_t n = read(timer_fd, &expirations, sizeof(expirations)); + assert(n >= 0); handle_timer(); } else { printf("Unknown source\n"); |