diff options
author | Daniel Mack <github@zonque.org> | 2015-07-23 23:20:18 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-07-23 23:20:18 +0200 |
commit | 6fa7ec3b6bf182e1bf2def75d0158888c0b189c9 (patch) | |
tree | d5a174fd68b4620c12ce1563106ab8a5773ac3e8 /src/basic/copy.c | |
parent | 37b4859186f8f21640306b18e352aaf97d7be178 (diff) | |
parent | 8420fa3acf205e3f42be9a2199dba55369ef7c61 (diff) |
Merge pull request #692 from poettering/fd-copy-directory-all
copy: when we recursively copy a directory tree, copy everything
Diffstat (limited to 'src/basic/copy.c')
-rw-r--r-- | src/basic/copy.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c index 230e7e4d3f..e2d356d676 100644 --- a/src/basic/copy.c +++ b/src/basic/copy.c @@ -24,6 +24,7 @@ #include "util.h" #include "btrfs-util.h" +#include "strv.h" #include "copy.h" #define COPY_BUFFER_SIZE (16*1024) @@ -262,10 +263,13 @@ static int fd_copy_directory( (void) copy_xattr(dirfd(d), fdt); } - FOREACH_DIRENT(de, d, return -errno) { + FOREACH_DIRENT_ALL(de, d, return -errno) { struct stat buf; int q; + if (STR_IN_SET(de->d_name, ".", "..")) + continue; + if (fstatat(dirfd(d), de->d_name, &buf, AT_SYMLINK_NOFOLLOW) < 0) { r = -errno; continue; |