1 /* Test for fdopen bugs. */
12 fputs ("test failed: " #x "\n", stderr); \
20 main (int argc
, char *argv
[])
22 char name
[] = "/tmp/tst-fdopen.XXXXXX";
30 printf ("mkstemp failed: %m\n");
34 fp
= fopen (name
, "w");
36 fputs ("foobar and baz", fp
);
40 fd
= open (name
, O_RDONLY
);
42 assert (lseek (fd
, 5, SEEK_SET
) == 5);
43 /* The file position indicator associated with the new stream is set to
44 the position indicated by the file offset associated with the file
46 fp
= fdopen (fd
, "r");
48 assert (getc (fp
) == 'r');
49 assert (getc (fp
) == ' ');