diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-06-06 17:33:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-06-07 13:27:38 +0200 |
commit | f6a77804c9d743e8d01051d2cb0511b53a49c56e (patch) | |
tree | a9f4f8e2944c28dbf7ececdc86418e8b6c755b86 /src/basic/copy.h | |
parent | ef202b848bb6635dec17d3ec0041b04cd2301bed (diff) | |
download | systemd-f6a77804c9d743e8d01051d2cb0511b53a49c56e.tar.gz |
copy: extend check for mount point crossing
We do this checks as protection against bind mount cycles on the same
file system. However, the check wasn't really effective for that, as
it would only detect cycles A → B → A this way. By using
fs_is_mount_point() we'll also detect cycles A → A.
Also, while we are at it, make these file system boundary checks
optional. This is not used anywhere, but might be eventually...
Most importantly though add a longer blurb explanation the why.
Diffstat (limited to 'src/basic/copy.h')
-rw-r--r-- | src/basic/copy.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/copy.h b/src/basic/copy.h index 0c50bcef50..fa84ba494e 100644 --- a/src/basic/copy.h +++ b/src/basic/copy.h @@ -13,9 +13,10 @@ #include <sys/types.h> typedef enum CopyFlags { - COPY_REFLINK = 1U << 0, /* Try to reflink */ - COPY_MERGE = 1U << 1, /* Merge existing trees with our new one to copy */ - COPY_REPLACE = 1U << 2, /* Replace an existing file if there's one */ + COPY_REFLINK = 1U << 0, /* Try to reflink */ + COPY_MERGE = 1U << 1, /* Merge existing trees with our new one to copy */ + COPY_REPLACE = 1U << 2, /* Replace an existing file if there's one */ + COPY_SAME_MOUNT = 1U << 3, /* Don't descend recursively into other file systems, across mount point boundaries */ } CopyFlags; int copy_file_fd(const char *from, int to, CopyFlags copy_flags); |