X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fmount-util.c;h=477342e71f433cb48c4c912d06e01e741ef700e1;hp=d1d5d415bb29c5be732d66ce9d6e3695251d184e;hb=2f30582bd3d00ce582d190ddb379e46e0a67f813;hpb=f47938b37644a3c961fd51de89b27cde2c54cc45 diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c index d1d5d415b..477342e71 100644 --- a/src/basic/mount-util.c +++ b/src/basic/mount-util.c @@ -161,7 +161,7 @@ int fd_is_mount_point(int fd, const char *filename, int flags) { fallback_fdinfo: r = fd_fdinfo_mnt_id(fd, filename, flags, &mount_id); - if (r == -EOPNOTSUPP) + if (IN_SET(r, -EOPNOTSUPP, -EACCES)) goto fallback_fstat; if (r < 0) return r; @@ -204,9 +204,10 @@ fallback_fstat: } /* flags can be AT_SYMLINK_FOLLOW or 0 */ -int path_is_mount_point(const char *t, int flags) { - _cleanup_close_ int fd = -1; +int path_is_mount_point(const char *t, const char *root, int flags) { _cleanup_free_ char *canonical = NULL, *parent = NULL; + _cleanup_close_ int fd = -1; + int r; assert(t); @@ -218,9 +219,9 @@ int path_is_mount_point(const char *t, int flags) { * /bin -> /usr/bin/ and /usr is a mount point, then the parent that we * look at needs to be /usr, not /. */ if (flags & AT_SYMLINK_FOLLOW) { - canonical = canonicalize_file_name(t); - if (!canonical) - return -errno; + r = chase_symlinks(t, root, &canonical); + if (r < 0) + return r; t = canonical; } @@ -473,7 +474,7 @@ int bind_remount_recursive(const char *prefix, bool ro, char **blacklist) { return r; /* Deal with mount points that are obstructed by a later mount */ - r = path_is_mount_point(x, 0); + r = path_is_mount_point(x, NULL, 0); if (r == -ENOENT || r == 0) continue; if (r < 0) @@ -525,6 +526,7 @@ bool fstype_is_network(const char *fstype) { "glusterfs\0" "pvfs2\0" /* OrangeFS */ "ocfs2\0" + "lustre\0" ; const char *x; @@ -583,6 +585,7 @@ const char* mode_to_inaccessible_node(mode_t mode) { return NULL; } +#if 0 /// UNNEEDED by elogind #define FLAG(name) (flags & name ? STRINGIFY(name) "|" : "") static char* mount_flags_to_string(long unsigned flags) { char *x; @@ -642,7 +645,7 @@ static char* mount_flags_to_string(long unsigned flags) { FLAG(MS_I_VERSION), FLAG(MS_STRICTATIME), FLAG(MS_LAZYTIME), - y, NULL); + y); if (!x) return NULL; if (!y) @@ -687,3 +690,4 @@ int umount_verbose(const char *what) { return log_error_errno(errno, "Failed to unmount %s: %m", what); return 0; } +#endif // 0