diff options
author | Frederic Berat <fberat@redhat.com> | 2023-06-12 17:18:21 +0200 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2023-06-13 19:59:08 -0400 |
commit | 7ba426a1115318fc11f4355f3161f35817a06ba4 (patch) | |
tree | af4aeb4348f06d4c8076475a892763612985ef59 /assert | |
parent | a84dcb4bdfe5070f2327da693d8b025c89b4877a (diff) | |
download | glibc-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.c | 8 | ||||
-rw-r--r-- | assert/test-assert.c | 8 |
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; |