]> git.ipfire.org Git - thirdparty/systemd.git/commit
copy: only check for traversing mount points on directories
authorFilipe Brandenburger <filbranden@google.com>
Mon, 4 Jun 2018 21:23:14 +0000 (14:23 -0700)
committerLennart Poettering <lennart@poettering.net>
Thu, 7 Jun 2018 11:14:20 +0000 (13:14 +0200)
commitef202b848bb6635dec17d3ec0041b04cd2301bed
treed49e9b3d21c08eeab62b02cf8be05b24267a7d05
parentb47837ac412ca9871a1dafa68ad7d77e5e0a76d7
copy: only check for traversing mount points on directories

This fixes the copy routines on overlay filesystem, which typically
returns the underlying st_dev for files, symlinks, etc.

The value of st_dev is guaranteed to be the same for directories, so
checking it on directories only fixes this code on overlay filesystem
and still keeps it from traversing mount points (which was the original
intent.)

There's a small side effect here, by which regular (non-directory) files
with bind mounts will be copied by the new logic (while they were
skipped by the previous logic.)

Tested: ./build/test-copy with an overlay on /tmp.

Fixes: #9134
src/basic/copy.c