summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-20 19:09:27 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-21 19:09:32 +0100
commit436e916eae03c97837425e157fbf6bb8ce5d5a53 (patch)
tree0815cc30f7d18ad9ff73facba37998b2c7ddffef /src/basic
parentfc2288f0be9384789c18259b66082c5fb395407f (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')
-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 ac5db71022..7e1914aa14 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -204,7 +204,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;
@@ -228,7 +228,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;