ctdb-tests: Pretend not to ignore return from fgets()
authorMartin Schwenke <martin@meltin.net>
Wed, 27 Jul 2016 05:44:20 +0000 (15:44 +1000)
committerStefan Metzmacher <metze@samba.org>
Thu, 28 Jul 2016 03:00:18 +0000 (05:00 +0200)
With some compilers and picky compiler settings, ignoring the return
value of fgets() can cause compilation to fail.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/src/fake_ctdbd.c

index 143acf87678d823981c23cc19c02d417a0440a0b..35bca88b28633d2b772a0e09fd90e67949401a56 100644 (file)
@@ -568,8 +568,13 @@ static bool reclock_parse(struct ctdbd_context *ctdb)
                goto fail;
        }
 ok:
-       /* Swallow possible blank line following section */
-       fgets(line, sizeof(line), stdin);
+       /* Swallow possible blank line following section.  Picky
+        * compiler settings don't allow the return value to be
+        * ignored, so make the compiler happy.
+        */
+       if (fgets(line, sizeof(line), stdin) == NULL) {
+               ;
+       }
        DEBUG(DEBUG_INFO, ("Parsing reclock done\n"));
        return true;