hddtemp: Improve robustness of test
authorBenjamin Gilbert <bgilbert@cs.cmu.edu>
Wed, 11 Mar 2015 04:28:36 +0000 (00:28 -0400)
committerBenjamin Gilbert <bgilbert@backtick.net>
Mon, 19 Sep 2016 06:35:12 +0000 (01:35 -0500)
Don't rely on signedness of buffer_size.

src/hddtemp.c

index 4e275dc..1178537 100644 (file)
@@ -171,7 +171,7 @@ static char *hddtemp_query_daemon (void)
        buffer_fill = 0;
        while (1)
        {
-               if (buffer_fill >= buffer_size - 1)
+               if ((buffer_size == 0) || (buffer_fill >= buffer_size - 1))
                {
                        if (buffer_size == 0)
                                buffer_size = 1024;