]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Always create files owner-writable.
authorEric Borisch <eborisch@gmail.com>
Fri, 1 Jun 2018 02:03:06 +0000 (21:03 -0500)
committerEric Borisch <eborisch@gmail.com>
Fri, 1 Jun 2018 02:03:06 +0000 (21:03 -0500)
Keeps TODO_MODE around if final_mode isn't owner writable, but lets
fsetxattr() succeed for non-root users. (Required for HFS+ compression.)

libarchive/archive_write_disk_posix.c

index 3fd5f57985149b238e2d8140b5eea52f51843649..88d4b5dd076aad95d069c74d4896874d08e48e18 100644 (file)
@@ -2223,6 +2223,13 @@ create_filesystem_object(struct archive_write_disk *a)
         */
        mode = final_mode & 0777 & ~a->user_umask;
 
+       if (a->todo & (TODO_HFS_COMPRESSION | 
+                      TODO_XATTR |
+                      TODO_MAC_METADATA)) {
+               /* Always create writable such that [f]setxattr() works */
+               mode |= 0200;
+       }
+
        switch (a->mode & AE_IFMT) {
        default:
                /* POSIX requires that we fall through here. */