chiark / gitweb /
util-lib: add new path_is_temporary_fs() API
[elogind.git] / src / basic / stat-util.c
index b62acdb7a164420435858f754a8a1bb2d6b9726d..0c3fbc8e1b3bf56300fa20422cb62cd556b67e98 100644 (file)
@@ -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);
+        if (fd < 0)
+                return -errno;
+
+        return fd_is_temporary_fs(fd);
+}