From: Florian Forster Date: Mon, 24 Nov 2008 18:23:25 +0000 (+0100) Subject: multimeter plugin: Check the return value of `write'. X-Git-Tag: collectd-4.4.5~12 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3e429a6d86ac6a0afe31f31b3d4417bc43dd979e;p=collectd.git multimeter plugin: Check the return value of `write'. This resolves warnings when compiling on GNU with: CPPFLAGS="-D_FORTIFY_SOURCE" --- 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);