| 1 | /* |
| 2 | chmod test */ |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <unistd.h> |
| 6 | #include <sys/stat.h> |
| 7 | #include <sys/types.h> |
| 8 | #include <fcntl.h> |
| 9 | |
| 10 | /* chmod to 0400 */ |
| 11 | int main(int argc, char **argv) { |
| 12 | int fid; |
| 13 | |
| 14 | /* test that the two args work. */ |
| 15 | if (argc < 3) { |
| 16 | exit(1); |
| 17 | } |
| 18 | |
| 19 | chmod(argv[1], 0400); |
| 20 | fid = open(argv[2], O_RDONLY); |
| 21 | //if (fchmod(fid, 0400)!=-1) |
| 22 | // return 1; /* this func will fail */ |
| 23 | close(fid); |
| 24 | |
| 25 | return 0; |
| 26 | } |