mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
28 lines
544 B
C
28 lines
544 B
C
|
/* Test for bug in fflush synchronization behavior. */
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
int main (void)
|
||
|
{
|
||
|
FILE *f;
|
||
|
off_t o;
|
||
|
char buffer [1024];
|
||
|
|
||
|
system ("echo 'From foo@bar.com' > test");
|
||
|
f = fopen ("test", "r");
|
||
|
fseek (f, 0, SEEK_END);
|
||
|
o = ftello (f);
|
||
|
fseek (f, 0, SEEK_SET);
|
||
|
fflush (f);
|
||
|
system ("echo 'From bar@baz.edu' >> test");
|
||
|
fseek (f, o, SEEK_SET);
|
||
|
if (fgets (buffer, 1024, f) == NULL)
|
||
|
abort ();
|
||
|
if (strncmp (buffer, "From ", 5) != 0)
|
||
|
abort ();
|
||
|
fclose (f);
|
||
|
exit (0);
|
||
|
}
|