summaryrefslogtreecommitdiff
path: root/src/basic/stat-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-20 19:09:27 +0100
committerSven Eden <yamakuzure@gmx.net>2017-07-17 17:58:35 +0200
commitce18349eedcec2ed6074c89e5ce9e7bee0770ec0 (patch)
tree90728f9c3f7e58cb755086c027100a3dc39512da /src/basic/stat-util.c
parent15ef4c05396195e9ee63c7afb49106eb5933fc83 (diff)
util-lib: rework path_check_fstype() and path_is_temporary_fs() to use O_PATH
Also, add tests to make sure this actually works as intended.
Diffstat (limited to 'src/basic/stat-util.c')
-rw-r--r--src/basic/stat-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
index 0c3fbc8e1..9dbdae0a0 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -212,7 +212,7 @@ int fd_check_fstype(int fd, statfs_f_type_t magic_value) {
int path_check_fstype(const char *path, statfs_f_type_t magic_value) {
_cleanup_close_ int fd = -1;
- fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
+ fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH);
if (fd < 0)
return -errno;
@@ -237,7 +237,7 @@ int fd_is_temporary_fs(int fd) {
int path_is_temporary_fs(const char *path) {
_cleanup_close_ int fd = -1;
- fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
+ fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH);
if (fd < 0)
return -errno;