about summary refs log tree commit diff
path: root/libio/bug-rewind.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-11-26 12:54:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-11-26 12:54:39 +0000
commit12da14a59135fe331f294b91488c1bdf55b35b4e (patch)
tree32c04ca07391dfc8df76cd782707e9f772016dbc /libio/bug-rewind.c
parentbd5dadac87467eec9d6ffc3f1b11897ea052a636 (diff)
downloadglibc-12da14a59135fe331f294b91488c1bdf55b35b4e.tar.gz
glibc-12da14a59135fe331f294b91488c1bdf55b35b4e.tar.xz
glibc-12da14a59135fe331f294b91488c1bdf55b35b4e.zip
Fix warnings in fwscanf / rewind tests.
This patch fixes "set but not used" warnings in the tests
libio/bug-rewind.c and libio/bug-rewind2.c by checking the return
values from fwscanf and making the tests fail if those values aren't
as expected.

Tested for x86_64.

	* libio/bug-rewind.c (do_test): Check fwscanf return values.
	* libio/bug-rewind2.c (do_test): Likewise.
Diffstat (limited to 'libio/bug-rewind.c')
-rw-r--r--libio/bug-rewind.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libio/bug-rewind.c b/libio/bug-rewind.c
index 4f8242df3d..1734de285f 100644
--- a/libio/bug-rewind.c
+++ b/libio/bug-rewind.c
@@ -52,9 +52,19 @@ do_test (void)
 
   rewind (fptr);
   ret1 = fwscanf (fptr, L"%c%c", &arg1, &arg2);
+  if (ret1 != 2)
+    {
+      printf ("first fwscanf returned %d, expected 2\n", ret1);
+      return 3;
+    }
 
   rewind (fptr);
   ret2 = fwscanf (fptr, L"%c%n%c", &arg1, &num, &arg2);
+  if (ret2 != 2)
+    {
+      printf ("second fwscanf returned %d, expected 2\n", ret2);
+      return 4;
+    }
 
   if (arg2 != 'd')
     {