Ticket #19048: foo.c
File foo.c, 440 bytes (added by , 2 months ago) |
---|
Line | |
---|---|
1 | #include <errno.h> |
2 | #include <stdio.h> |
3 | #include <string.h> |
4 | #include <unistd.h> |
5 | #include <assert.h> |
6 | |
7 | int |
8 | main () |
9 | { |
10 | char buf[80]; |
11 | int ret = readlinkat (-1, "link", buf, sizeof (buf)); |
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 | } |