From b99da405e7bc46006ab04c418e445387abfc1a5f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 12 Oct 2018 09:35:19 -0400 Subject: [PATCH] Assert read return value in examples/input-method --- examples/input-method.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/input-method.c b/examples/input-method.c index 9c2d5524a..3e485d1c5 100644 --- a/examples/input-method.c +++ b/examples/input-method.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include #include #include #include @@ -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");