mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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>
This commit is contained in:
committed by
Siddhesh Poyarekar
parent
a84dcb4bdf
commit
7ba426a111
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user