x86-64/memset: Mark the debugger symbol as hidden
[glibc.git] / dirent / tst-fdopendir2.c
blob7709e4b3bcee295472335c690ad2369756f2acfc
1 #include <errno.h>
2 #include <dirent.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <unistd.h>
8 static int
9 do_test (void)
11 char tmpl[] = "/tmp/tst-fdopendir2-XXXXXX";
12 int fd = mkstemp (tmpl);
13 if (fd == -1)
15 puts ("cannot open temp file");
16 return 1;
19 errno = 0;
20 DIR *d = fdopendir (fd);
22 int e = errno;
24 close (fd);
25 unlink (tmpl);
27 if (d != NULL)
29 puts ("fdopendir with normal file descriptor did not fail");
30 return 1;
32 if (e != ENOTDIR)
34 printf ("fdopendir set errno to %d, not %d as expected\n", e, ENOTDIR);
35 return 1;
38 return 0;
41 #define TEST_FUNCTION do_test ()
42 #include "../test-skeleton.c"