]> git.ipfire.org Git - thirdparty/glibc.git/blame - dirent/tst-fdopendir2.c
Don't reduce test timeout to less than default
[thirdparty/glibc.git] / dirent / tst-fdopendir2.c
CommitLineData
a4f17630
UD
1#include <errno.h>
2#include <dirent.h>
3#include <stdio.h>
ceaa9889 4#include <stdlib.h>
a4f17630
UD
5#include <unistd.h>
6
7
8static int
9do_test (void)
10{
11 char tmpl[] = "/tmp/tst-fdopendir2-XXXXXX";
12 int fd = mkstemp (tmpl);
13 if (fd == -1)
14 {
15 puts ("cannot open temp file");
16 return 1;
17 }
18
19 errno = 0;
20 DIR *d = fdopendir (fd);
21
22 int e = errno;
23
24 close (fd);
25 unlink (tmpl);
26
27 if (d != NULL)
28 {
29 puts ("fdopendir with normal file descriptor did not fail");
30 return 1;
31 }
32 if (e != ENOTDIR)
33 {
34 printf ("fdopendir set errno to %d, not %d as expected\n", e, ENOTDIR);
35 return 1;
36 }
37
38 return 0;
39}
40
41#define TEST_FUNCTION do_test ()
42#include "../test-skeleton.c"