]> Savannah Git Hosting - gnulib.git/commitdiff
Fix some "gcc -Wall" warnings.
authorBruno Haible <bruno@clisp.org>
Sun, 16 Oct 2016 14:59:45 +0000 (16:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 22 Oct 2016 17:28:34 +0000 (19:28 +0200)
* tests/test-ffsl.c (main): Use variable x, not i.
* tests/test-posix_spawn3.c (parent_main): Consider the return value of
freopen.
* tests/test-sethostname1.c (main): Explicitly ignore the return value
of sethostname.

ChangeLog
tests/test-ffsl.c
tests/test-posix_spawn3.c
tests/test-sethostname1.c

index bff00494d2739ea0ce8d120f8595ba62ce5af0dc..edc5962952a8ad7d8c14a75df3fd0bb58241a71b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-10-16  Bruno Haible  <bruno@clisp.org>
+
+       Fix some "gcc -Wall" warnings.
+       * tests/test-ffsl.c (main): Use variable x, not i.
+       * tests/test-posix_spawn3.c (parent_main): Consider the return value of
+       freopen.
+       * tests/test-sethostname1.c (main): Explicitly ignore the return value
+       of sethostname.
+
 2016-10-16  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool: Make --create-testdir on all modules work again.
index e903509096a8006470bbef86d567b04609e53be5..117bc4ab8f4b53b362bf42ffd511902c398dcbc2 100644 (file)
@@ -44,8 +44,8 @@ main (int argc, char *argv[])
   long int x;
   int i;
 
-  for (i = -128; i <= 128; i++)
-    ASSERT (ffsl (i) == naive (i));
+  for (x = -128; x <= 128; x++)
+    ASSERT (ffsl (x) == naive (x));
   for (i = 0; i < NBITS; i++)
     {
       ASSERT (ffsl (1UL << i) == naive (1UL << i));
index 90745fdc12e528f395b3888eeffb689c6f060368..f2a699c8bd5d237609b0c549e6db54bff8fc299d 100644 (file)
@@ -75,7 +75,11 @@ parent_main (void)
     }
 
   /* Avoid reading from our stdin, as it could block.  */
-  freopen ("/dev/null", "rb", stdin);
+  if (freopen ("/dev/null", "rb", stdin) == NULL)
+    {
+      perror ("cannot redirect stdin");
+      return 1;
+    }
 
   /* Test whether posix_spawn_file_actions_addopen with this file name
      actually works, but spawning a child that reads from this file.  */
index 5ed6a8360bcfbe63f416a830f682866e95148ac7..08441f328150127ef06853add83a63fc1b7ab89a 100644 (file)
@@ -30,8 +30,11 @@ main ()
   /* Some code that has a link-time dependency to the sethostname() function
      and that is likely not optimized away by compilers.  */
   if (do_dangerous_things)
-    /* Never executed.  */
-    sethostname ("oprah", 5);
+    {
+      /* Never executed.  */
+      int ret = sethostname ("oprah", 5);
+      (void) ret;
+    }
 
   return 0;
 }