| 1 | /* |
| 2 | |
| 3 | test |
| 4 | close(0); |
| 5 | open(XXX,XXX); |
| 6 | will return '0' as file ID. |
| 7 | |
| 8 | */ |
| 9 | #include <stdio.h> |
| 10 | #include <stdlib.h> |
| 11 | #include <unistd.h> |
| 12 | #include <sys/types.h> |
| 13 | #include <sys/stat.h> |
| 14 | #include <fcntl.h> |
| 15 | |
| 16 | int main(int ac, const char **av) { |
| 17 | int fd1, fd2; |
| 18 | close(0); |
| 19 | fd1 = open(av[1], O_RDONLY); |
| 20 | close(0); |
| 21 | fd2 = open(av[1], O_RDONLY); |
| 22 | |
| 23 | printf("close(0)open(): try1: %i, try2: %i\n", fd1, fd2); |
| 24 | |
| 25 | return fd1; |
| 26 | } |