X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fbasic%2Fstat-util.c;h=9dbdae0a0397d4df6fd9fa93da884e0da3285a20;hb=a1002c6e2e7933c03aa4f49bdbce31e246ab589d;hp=b62acdb7a164420435858f754a8a1bb2d6b9726d;hpb=2ab3c9b133f3a79f940593cc40b4555f6bfd7f4a;p=elogind.git diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index b62acdb7a..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; @@ -233,3 +233,13 @@ int fd_is_temporary_fs(int fd) { return is_temporary_fs(&s); } + +int path_is_temporary_fs(const char *path) { + _cleanup_close_ int fd = -1; + + fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_PATH); + if (fd < 0) + return -errno; + + return fd_is_temporary_fs(fd); +}