* Test that flopen() can open an existing file. */
| 66 | * Test that flopen() can open an existing file. |
| 67 | */ |
| 68 | const char * |
| 69 | test_flopen_open(void) |
| 70 | { |
| 71 | const char *fn = "test_flopen_open"; |
| 72 | const char *result = NULL; |
| 73 | int fd; |
| 74 | |
| 75 | fd = open(fn, O_RDWR|O_CREAT, 0640); |
| 76 | if (fd < 0) { |
| 77 | result = strerror(errno); |
| 78 | } else { |
| 79 | close(fd); |
| 80 | fd = flopen(fn, O_RDWR); |
| 81 | if (fd < 0) { |
| 82 | result = strerror(errno); |
| 83 | } else { |
| 84 | close(fd); |
| 85 | } |
| 86 | } |
| 87 | unlink(fn); |
| 88 | return (result); |
| 89 | } |
| 90 | |
| 91 | /* |
| 92 | * Test that flopen() can lock against itself |