diff options
-rw-r--r-- | src/basic/fs-util.c | 4 | ||||
-rw-r--r-- | src/basic/fs-util.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index cf5c80eca..c8b5ad432 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <linux/magic.h> #include <time.h> #include <unistd.h> @@ -733,6 +734,9 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags, if (fstat(child, &st) < 0) return -errno; + if ((flags & CHASE_NO_AUTOFS) && + fd_check_fstype(child, AUTOFS_SUPER_MAGIC) > 0) + return -EREMOTE; if (S_ISLNK(st.st_mode)) { char *joined; diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 4c6bb659a..a9ec7611d 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -96,6 +96,7 @@ int inotify_add_watch_fd(int fd, int what, uint32_t mask); enum { CHASE_PREFIX_ROOT = 1, /* If set, the specified path will be prefixed by the specified root before beginning the iteration */ CHASE_NONEXISTENT = 2, /* If set, it's OK if the path doesn't actually exist. */ + CHASE_NO_AUTOFS = 4, /* If set, return -EREMOTE if autofs mount point found */ }; int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret); |