chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
commitcca09ee8d6ece8e22b638efd05c4c0eb49e91b91
tree4d0ab3b118e181df7c5bb2b3d2ea4d27097aecde
parentc4c4363b1f9e385d45824ed2b6849df7c0e54bd2
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