mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
util-lib: add new path_is_temporary_fs() API
As simple wrapper around fd_is_temporary_fs().
This commit is contained in:
parent
ae59114af9
commit
ffeb828596
@ -224,3 +224,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);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ int path_check_fstype(const char *path, statfs_f_type_t magic_value);
|
||||
|
||||
bool is_temporary_fs(const struct statfs *s) _pure_;
|
||||
int fd_is_temporary_fs(int fd);
|
||||
int path_is_temporary_fs(const char *path);
|
||||
|
||||
/* Because statfs.t_type can be int on some architectures, we have to cast
|
||||
* the const magic to the type, otherwise the compiler warns about
|
||||
|
Loading…
x
Reference in New Issue
Block a user