Ticket #19049: foo.c

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

test case foo.c

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