Ticket #19060: foo.c

File foo.c, 437 bytes (added by bhaible, 2 months ago)

test case foo.c

Line 
1#include <errno.h>
2#include <dirent.h>
3#include <stdio.h>
4#include <string.h>
5#include <assert.h>
6
7int
8main ()
9{
10 {
11 errno = 0;
12 DIR *ret = fdopendir (-1);
13
14 if (ret != NULL)
15 printf ("ret = %p\n", ret);
16 else if (errno == EBADF)
17 printf ("ret = NULL, errno == EBADF\n");
18 else
19 printf ("ret = NULL, errno == %s\n", strerror (errno));
20
21 assert (ret == NULL && errno == EBADF);
22 }
23
24 printf ("OK\n");
25}