1 /* If stdio is working correctly, after this is run infile and outfile
2 will have the same contents. If the bug (found in GNU C library 0.3)
3 exhibits itself, outfile will be missing the 2nd through 1023rd
10 #include <support/support.h>
12 static char buf
[8192];
19 static char inname
[] = OBJPFX
"bug5test.in";
20 static char outname
[] = OBJPFX
"bug5test.out";
25 /* Create a test file. */
26 in
= fopen (inname
, "w+");
32 for (i
= 0; i
< 1000; ++i
)
33 fprintf (in
, "%Zu\n", i
);
35 out
= fopen (outname
, "w");
41 if (fseek (in
, 0L, SEEK_SET
) != 0)
43 putc (getc (in
), out
);
44 i
= fread (buf
, 1, sizeof (buf
), in
);
50 if (fwrite (buf
, 1, i
, out
) != i
)
58 puts ("There should be no further output from this test.");
61 /* We must remove this entry to assure the `cmp' binary does not use
62 the perhaps incompatible new shared libraries. */
63 unsetenv ("LD_LIBRARY_PATH");
65 printbuf
= xasprintf ("cmp %s %s", inname
, outname
);
66 result
= system (printbuf
);