- /* Needed to obtain |O_PATH| */
- #ifndef _GNU_SOURCE
- #define _GNU_SOURCE 1
- #endif
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <sys/statfs.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- int main(int ac, char *av[])
- {
- int fd;
- struct statfs statfsbuf;
- fd = open("/tmp", O_RDONLY|O_PATH);
- if (fd < 0)
- {
- return EXIT_FAILURE;
- }
- if (fstatfs(fd, &statfsbuf) != 0)
- {
- return EXIT_FAILURE;
- }
- (void)close(fd);
- return EXIT_SUCCESS;
- }
Does |fstatfs()| work with fd from |O_PATH| ? Yes...
Posted by Anonymous on Wed 19th Feb 2020 12:40
raw | new post
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.