diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-12-08 19:39:50 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-07-17 17:58:35 +0200 |
commit | 277d0c5729bd21cd925596d4ca806c32aa7c8db5 (patch) | |
tree | da60075b94ecc049ca5d7917bd8f5cd8ff5b3d68 /src/basic/stat-util.c | |
parent | 2ab3c9b133f3a79f940593cc40b4555f6bfd7f4a (diff) |
util-lib: add new path_is_temporary_fs() API
As simple wrapper around fd_is_temporary_fs().
Diffstat (limited to 'src/basic/stat-util.c')
-rw-r--r-- | src/basic/stat-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index b62acdb7a..0c3fbc8e1 100644 --- a/src/basic/stat-util.c +++ b/src/basic/stat-util.c @@ -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); +} |