1 /* Test for fdopen bugs. */
11 fputs ("test failed: " #x "\n", stderr); \
17 main (int argc, char *argv[])
24 /* hack to get a tempfile name w/out using tmpname()
25 * as that func causes a link time warning */
26 sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__);
30 fp = fopen (name, "w");
32 assert (fputs ("foobar and baz", fp) > 0);
33 assert (fclose (fp) == 0);
36 fd = open (name, O_RDWR|O_CREAT, 0660);
38 assert (lseek (fd, 5, SEEK_SET) == 5);
40 fp = fdopen (fd, "a");
42 /* SuSv3 says that doing a fdopen() does not reset the file position,
43 * thus the '5' here is correct, not '14'. */
44 assert (ftell (fp) == 5);
48 assert (fclose (fp) == 0);