]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: Make C still copy if the destination directory is empty
authorRyan Gonzalez <rymg19@gmail.com>
Mon, 7 Jan 2019 00:12:31 +0000 (18:12 -0600)
committerRyan Gonzalez <rymg19@gmail.com>
Tue, 8 Jan 2019 20:30:15 +0000 (14:30 -0600)
Fixes #11287.

man/tmpfiles.d.xml
src/tmpfiles/tmpfiles.c

index 5d393f3984053070fdc10fd14cb2af27f07ef969..bc6c8cdf432b60049600fdf8207631a3e06a3b69 100644 (file)
@@ -282,11 +282,11 @@ L     /tmp/foobar -    -    -     -   /dev/null</programlisting>
         <varlistentry>
           <term><varname>C</varname></term>
           <listitem><para>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
           <filename>/usr/share/factory/</filename> with the same name
           are copied. Does not follow symlinks.</para></listitem>
         </varlistentry>
index 19225f8cfd7135182d36555b9eb0cdbbb38081bf..03a9e1d1f0243df99fb9899bb047b16e30b44f92 100644 (file)
@@ -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;