Ticket #18355: foo.c
File foo.c, 439 bytes (added by , 20 months ago) |
---|
Line | |
---|---|
1 | #include <fcntl.h> |
2 | #include <unistd.h> |
3 | #include <stdio.h> |
4 | #include <string.h> |
5 | #include <errno.h> |
6 | |
7 | #ifndef O_BINARY |
8 | # define O_BINARY 0 |
9 | #endif |
10 | |
11 | int main () |
12 | { |
13 | int ret; |
14 | |
15 | unlink ("link4"); |
16 | unlink ("file4"); |
17 | ret = symlink ("file4", "link4"); |
18 | printf ("symlink -> %d\n", ret); |
19 | ret = open ("link4", O_RDWR | O_BINARY | O_TRUNC | O_CREAT, 0666); |
20 | if (ret < 0) |
21 | perror ("open"); |
22 | else |
23 | printf ("ret -> %d\n", ret); |
24 | return 0; |
25 | } |