From 3e429a6d86ac6a0afe31f31b3d4417bc43dd979e Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 24 Nov 2008 19:23:25 +0100 Subject: [PATCH] multimeter plugin: Check the return value of `write'. This resolves warnings when compiling on GNU with: CPPFLAGS="-D_FORTIFY_SOURCE" --- src/multimeter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/multimeter.c b/src/multimeter.c index c6b070a0..db357460 100644 --- a/src/multimeter.c +++ b/src/multimeter.c @@ -86,7 +86,12 @@ static int multimeter_read_value(double *value) struct timeval timeout; struct timeval time_now; - write(fd, "D", 1); + status = swrite (fd, "D", 1); + if (status < 0) + { + ERROR ("multimeter plugin: swrite failed."); + return (-1); + } FD_ZERO(&rfds); FD_SET(fd, &rfds); -- 2.30.2