From: Ryan Gonzalez Date: Mon, 7 Jan 2019 00:12:31 +0000 (-0600) Subject: tmpfiles: Make C still copy if the destination directory is empty X-Git-Tag: v241-rc1~67^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a6f4464571f516c44af731b033e557671bcf8ca5;p=thirdparty%2Fsystemd.git tmpfiles: Make C still copy if the destination directory is empty Fixes #11287. --- diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml index 5d393f39840..bc6c8cdf432 100644 --- a/man/tmpfiles.d.xml +++ b/man/tmpfiles.d.xml @@ -282,11 +282,11 @@ L /tmp/foobar - - - - /dev/null C Recursively copy a file or directory, if the - destination files or directories do not exist yet. Note that - this command will not descend into subdirectories if the - destination directory already exists. Instead, the entire - copy operation is skipped. If the argument is omitted, files - from the source directory + destination files or directories do not exist yet or the + destination directory is empty. Note that this command will not + descend into subdirectories if the destination directory already + exists and is not empty. Instead, the entire copy operation is + skipped. If the argument is omitted, files from the source directory /usr/share/factory/ with the same name are copied. Does not follow symlinks. diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 19225f8cfd7..03a9e1d1f02 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1463,7 +1463,7 @@ static int copy_files(Item *i) { dfd, bn, i->uid_set ? i->uid : UID_INVALID, i->gid_set ? i->gid : GID_INVALID, - COPY_REFLINK); + COPY_REFLINK | COPY_MERGE_EMPTY); if (r < 0) { struct stat a, b;