]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
archive_write_disk_posix: Symlinks can have AppleDouble data
authorDag-Erling Smørgrav <des@des.dev>
Wed, 24 Jun 2026 15:55:41 +0000 (17:55 +0200)
committerDag-Erling Smørgrav <des@des.dev>
Wed, 24 Jun 2026 16:25:01 +0000 (18:25 +0200)
libarchive/archive_write_disk_posix.c

index 9a6098daf1c9ea61b5a2d59fdc0c8336f35dc0c6..a27e73188b3709b32e72172cedcfb3df1c8b50d2 100644 (file)
@@ -4350,7 +4350,7 @@ copy_metadata(struct archive_write_disk *a, const char *metadata,
                 * with at least a writing mode(O_RDWR or O_WRONLY). it
                 * makes the data fork uncompressed.
                 */
-               dffd = open(datafork, 0);
+               dffd = open(datafork, O_SYMLINK);
                if (dffd == -1) {
                        archive_set_error(&a->archive, errno,
                            "Failed to open the data fork for metadata");
@@ -4459,7 +4459,9 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname)
        if (la_stat(datafork.s, &st) == -1)
                goto skip_appledouble;
 #endif
-       if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode))
+       if (!S_ISREG(st.st_mode) &&
+           !S_ISDIR(st.st_mode) &&
+           !S_ISLNK(st.st_mode))
                goto skip_appledouble;
 
        /*