diff options
author | Frederic Berat <fberat@redhat.com> | 2023-06-12 17:18:20 +0200 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2023-06-13 19:59:08 -0400 |
commit | a84dcb4bdfe5070f2327da693d8b025c89b4877a (patch) | |
tree | e551263f0622ab6dd69fe3ff1adf4aa0790320a9 /stdio-common/bug12.c | |
parent | 127c21c0e2f669454835f78fc03079866282c19b (diff) | |
download | glibc-a84dcb4bdfe5070f2327da693d8b025c89b4877a.tar.gz glibc-a84dcb4bdfe5070f2327da693d8b025c89b4877a.tar.xz glibc-a84dcb4bdfe5070f2327da693d8b025c89b4877a.zip |
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>
Diffstat (limited to 'stdio-common/bug12.c')
-rw-r--r-- | stdio-common/bug12.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/stdio-common/bug12.c b/stdio-common/bug12.c index 48610c0e78..1ba296deb4 100644 --- a/stdio-common/bug12.c +++ b/stdio-common/bug12.c @@ -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; |