}
#endif // 0
-int files_same(const char *filea, const char *fileb) {
+int files_same(const char *filea, const char *fileb, int flags) {
struct stat a, b;
assert(filea);
assert(fileb);
- if (stat(filea, &a) < 0)
+ if (fstatat(AT_FDCWD, filea, &a, flags) < 0)
return -errno;
- if (stat(fileb, &b) < 0)
+ if (fstatat(AT_FDCWD, fileb, &b, flags) < 0)
return -errno;
return a.st_dev == b.st_dev &&
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;
is_fs_type(s, RAMFS_MAGIC);
}
+#if 0 /// UNNEEDED by elogind
int fd_is_temporary_fs(int fd) {
struct statfs s;
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);
+}
+#endif // 0