deploy: Ignore sockets, fifos in /etc/<subdir> during merge
authorYuanhong Peng <yummypeng@linux.alibaba.com>
Mon, 22 Jan 2024 10:03:55 +0000 (18:03 +0800)
committerYuanhong Peng <yummypeng@linux.alibaba.com>
Mon, 22 Jan 2024 11:48:59 +0000 (19:48 +0800)
It's a followup of commit e6a560b40797324aa8b90e7100c6d50bff91f14d.
We should also ignore sockets and fifos in the subdir of /etc.

Signed-off-by: Yuanhong Peng <yummypeng@linux.alibaba.com>
src/libostree/ostree-sysroot-deploy.c

index 5c941d517032449e250805df356e1608ab2e4c33..3a537fcb584271b6d41df4e003bb51d68ea5d51f 100644 (file)
@@ -323,11 +323,20 @@ copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name,
         }
       else
         {
-          if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf, dest_dfd,
-                                  dent->d_name,
-                                  sysroot_flags_to_copy_flags (GLNX_FILE_COPY_OVERWRITE, flags),
-                                  cancellable, error))
-            return glnx_prefix_error (error, "Copying %s", dent->d_name);
+          if (S_ISLNK (child_stbuf.st_mode) || S_ISREG (child_stbuf.st_mode))
+            {
+              if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf, dest_dfd,
+                                      dent->d_name,
+                                      sysroot_flags_to_copy_flags (GLNX_FILE_COPY_OVERWRITE, flags),
+                                      cancellable, error))
+                return glnx_prefix_error (error, "Copying %s", dent->d_name);
+            }
+          else
+            {
+              ot_journal_print (LOG_INFO,
+                                "Ignoring non-regular/non-symlink file found during /etc merge: %s",
+                                dent->d_name);
+            }
         }
     }