1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-13 23:21:08 +03:00

copy: when we recursively copy a directory tree, copy everything

Don't ignore hidden files and directories.

Fixes #386
This commit is contained in:
Lennart Poettering 2015-07-23 21:41:22 +02:00
parent bd5ecd55c8
commit 8420fa3acf

View File

@ -24,6 +24,7 @@
#include "util.h" #include "util.h"
#include "btrfs-util.h" #include "btrfs-util.h"
#include "strv.h"
#include "copy.h" #include "copy.h"
#define COPY_BUFFER_SIZE (16*1024) #define COPY_BUFFER_SIZE (16*1024)
@ -262,10 +263,13 @@ static int fd_copy_directory(
(void) copy_xattr(dirfd(d), fdt); (void) copy_xattr(dirfd(d), fdt);
} }
FOREACH_DIRENT(de, d, return -errno) { FOREACH_DIRENT_ALL(de, d, return -errno) {
struct stat buf; struct stat buf;
int q; int q;
if (STR_IN_SET(de->d_name, ".", ".."))
continue;
if (fstatat(dirfd(d), de->d_name, &buf, AT_SYMLINK_NOFOLLOW) < 0) { if (fstatat(dirfd(d), de->d_name, &buf, AT_SYMLINK_NOFOLLOW) < 0) {
r = -errno; r = -errno;
continue; continue;