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 static char buf[8192];
17 static char inname[] = "/tmp/bug5.in";
18 static char outname[] = "/tmp/bug5.out";
23 /* Create a test file. */
24 in = fopen (inname, "w+");
30 for (i = 0; i < 1000; ++i)
31 fprintf (in, "%Zu\n", i);
33 out = fopen (outname, "w");
39 if (fseek (in, 0L, SEEK_SET) != 0)
41 putc (getc (in), out);
42 i = fread (buf, 1, sizeof (buf), in);
48 if (fwrite (buf, 1, i, out) != i)
56 puts ("There should be no further output from this test.");
59 /* We must remove this entry to assure the `cmp' binary does not use
60 the perhaps incompatible new shared libraries. */
61 unsetenv ("LD_LIBRARY_PATH");
63 asprintf (&printbuf, "cmp %s %s", inname, outname);
64 result = system (printbuf);