Merge pull request #1746 from rubenk/swrite-check-for-open-fd
authorSebastian Harl <sh@tokkee.org>
Sun, 5 Jun 2016 12:27:11 +0000 (14:27 +0200)
committerSebastian Harl <sh@tokkee.org>
Sun, 5 Jun 2016 12:27:11 +0000 (14:27 +0200)
swrite: return error if fd is negative

src/apcups.c

index 2d1c16b..9f7476b 100644 (file)
@@ -89,7 +89,7 @@ static int net_shutdown (int *fd)
        if ((fd == NULL) || (*fd < 0))
                return (EINVAL);
 
-       swrite (*fd, (void *) &packet_size, sizeof (packet_size));
+       (void)swrite (*fd, (void *) &packet_size, sizeof (packet_size));
        close (*fd);
        *fd = -1;