about summary refs log tree commit diff
path: root/assert
diff options
context:
space:
mode:
authorFrederic Berat <fberat@redhat.com>2023-06-12 17:18:21 +0200
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-06-13 19:59:08 -0400
commit7ba426a1115318fc11f4355f3161f35817a06ba4 (patch)
treeaf4aeb4348f06d4c8076475a892763612985ef59 /assert
parenta84dcb4bdfe5070f2327da693d8b025c89b4877a (diff)
downloadglibc-7ba426a1115318fc11f4355f3161f35817a06ba4.tar.gz
glibc-7ba426a1115318fc11f4355f3161f35817a06ba4.tar.xz
glibc-7ba426a1115318fc11f4355f3161f35817a06ba4.zip
tests: replace fgets by xfgets
With fortification enabled, fgets calls return result needs to be checked,
has it gets the __wur macro enabled.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'assert')
-rw-r--r--assert/test-assert-perr.c8
-rw-r--r--assert/test-assert.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/assert/test-assert-perr.c b/assert/test-assert-perr.c
index 8496db6ffd..09a4fcb6ef 100644
--- a/assert/test-assert-perr.c
+++ b/assert/test-assert-perr.c
@@ -11,6 +11,8 @@
 #include <string.h>
 #include <setjmp.h>
 
+#include <support/xstdio.h>
+
 jmp_buf rec;
 char buf[160];
 
@@ -70,15 +72,15 @@ main(void)
     failed = 1; /* should not happen */
 
   rewind (stderr);
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (!strstr(buf, strerror (1)))
     failed = 1;
 
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (strstr (buf, strerror (0)))
     failed = 1;
 
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (strstr (buf, strerror (2)))
     failed = 1;
 
diff --git a/assert/test-assert.c b/assert/test-assert.c
index 26b58d4dd3..25e264543b 100644
--- a/assert/test-assert.c
+++ b/assert/test-assert.c
@@ -11,6 +11,8 @@
 #include <string.h>
 #include <setjmp.h>
 
+#include <support/xstdio.h>
+
 jmp_buf rec;
 char buf[160];
 
@@ -72,15 +74,15 @@ main (void)
     failed = 1; /* should not happen */
 
   rewind (stderr);
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (!strstr (buf, "1 == 2"))
     failed = 1;
 
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (strstr (buf, "1 == 1"))
     failed = 1;
 
-  fgets (buf, 160, stderr);
+  xfgets (buf, 160, stderr);
   if (strstr (buf, "2 == 3"))
     failed = 1;