From 6027a837f2271ad28b1e47c798687368b870842e Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Wed, 31 Oct 2012 08:47:36 +0900 Subject: [PATCH] Correct handling user_umask in create_filesystem_object function. It usually made a new file with a zero file mode though that was changed later. The file its mode was a zero prevented doing fsetxattr system call in success with the exception of running by super user on Mac. --- libarchive/archive_write_disk_posix.c | 2 +- libarchive/archive_write_disk_windows.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 8ae02a8eb..81458b398 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -1886,7 +1886,7 @@ create_filesystem_object(struct archive_write_disk *a) * that SUID, SGID, etc, require additional work to ensure * security, so we never restore them at this point. */ - mode = final_mode & 0777 & a->user_umask; + mode = final_mode & 0777 & ~a->user_umask; switch (a->mode & AE_IFMT) { default: diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c index 39fd65fa0..0f0780a8e 100644 --- a/libarchive/archive_write_disk_windows.c +++ b/libarchive/archive_write_disk_windows.c @@ -1511,7 +1511,7 @@ create_filesystem_object(struct archive_write_disk *a) * that SUID, SGID, etc, require additional work to ensure * security, so we never restore them at this point. */ - mode = final_mode & 0777 & a->user_umask; + mode = final_mode & 0777 & ~a->user_umask; switch (a->mode & AE_IFMT) { default: -- 2.47.2