1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +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:
Frederic Berat
2023-06-12 17:18:20 +02:00
committed by Siddhesh Poyarekar
parent 127c21c0e2
commit a84dcb4bdf
9 changed files with 65 additions and 12 deletions

View File

@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <support/xstdio.h>
static char *fname;
@@ -48,7 +49,7 @@ do_test (void)
perror ("fopen(\"r\")");
}
fread (buf, 3, 1, f);
xfread (buf, 3, 1, f);
errno = 0;
if (fseek (f, -10, SEEK_CUR) == 0)
{
@@ -72,7 +73,7 @@ Got %d instead\n",
perror ("fopen(\"r+\")");
}
fread (buf, 3, 1, f);
xfread (buf, 3, 1, f);
errno = 0;
if (fseek (f, -10, SEEK_CUR) == 0)
{
@@ -96,7 +97,7 @@ Got %d instead\n",
perror ("fopen(\"r+\")");
}
fread (buf, 3, 1, f);
xfread (buf, 3, 1, f);
if (ftell (f) != 3)
{
puts ("ftell failed");