12345678910111213141516171819202122232425 |
- #include <fcntl.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <unistd.h>
- int main(int argc, char** argv) {
- for (int i = 0; i < 10000; i++) {
- int fd = open(argv[0], O_RDONLY);
- if (fd == -1) abort();
- char buf[1024];
- ssize_t read_ret = read(fd, buf, sizeof(buf));
- if (read_ret == -1) abort();
- int ret = close(fd);
- if (ret == -1) abort();
- }
- puts("Test succeeded.");
- return 0;
- }
|