mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
tests: replace fread by xfread
With fortification enabled, fread 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
127c21c0e2
commit
a84dcb4bdf
@@ -1,6 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <support/xstdio.h>
|
||||
|
||||
char x[4096], z[4096], b[21], m[4096 * 4];
|
||||
|
||||
int
|
||||
@@ -20,24 +22,24 @@ main (void)
|
||||
}
|
||||
rewind (f);
|
||||
|
||||
fread (m, 4096 * 4 - 10, 1, f);
|
||||
fread (b, 20, 1, f);
|
||||
xfread (m, 4096 * 4 - 10, 1, f);
|
||||
xfread (b, 20, 1, f);
|
||||
printf ("got %s (should be %s)\n", b, "zzzzzzzzzzxxxxxxxxxx");
|
||||
if (strcmp (b, "zzzzzzzzzzxxxxxxxxxx"))
|
||||
failed = 1;
|
||||
|
||||
fseek (f, -40, SEEK_CUR);
|
||||
fread (b, 20, 1, f);
|
||||
xfread (b, 20, 1, f);
|
||||
printf ("got %s (should be %s)\n", b, "zzzzzzzzzzzzzzzzzzzz");
|
||||
if (strcmp (b, "zzzzzzzzzzzzzzzzzzzz"))
|
||||
failed = 1;
|
||||
|
||||
fread (b, 20, 1, f);
|
||||
xfread (b, 20, 1, f);
|
||||
printf ("got %s (should be %s)\n", b, "zzzzzzzzzzxxxxxxxxxx");
|
||||
if (strcmp (b, "zzzzzzzzzzxxxxxxxxxx"))
|
||||
failed = 1;
|
||||
|
||||
fread (b, 20, 1, f);
|
||||
xfread (b, 20, 1, f);
|
||||
printf ("got %s (should be %s)\n", b, "xxxxxxxxxxxxxxxxxxxx");
|
||||
if (strcmp (b, "xxxxxxxxxxxxxxxxxxxx"))
|
||||
failed = 1;
|
||||
|
Reference in New Issue
Block a user