Ticket #19050: foo.c

File foo.c, 479 bytes (added by bhaible, 2 weeks ago)

test case foo.c

Line 
1#include <errno.h>
2#include <sys/stat.h>
3#include <stdio.h>
4#include <string.h>
5#include <assert.h>
6
7int
8main ()
9{
10 struct stat statbuf;
11
12 {
13 errno = 0;
14 int ret = fstatat (-1, "foo", &statbuf, 0);
15
16 if (ret >= 0)
17 printf ("ret = %d\n", ret);
18 else if (errno == EBADF)
19 printf ("ret = %d, errno == EBADF\n", ret);
20 else
21 printf ("ret = %d, errno == %s\n", ret, strerror (errno));
22
23 assert (ret < 0 && errno == EBADF);
24 }
25
26 printf ("OK\n");
27}