From: Michihiro NAKAJIMA Date: Tue, 30 Oct 2012 23:47:36 +0000 (+0900) Subject: Correct handling user_umask in create_filesystem_object function. X-Git-Tag: v3.1.0~40^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6027a837f2271ad28b1e47c798687368b870842e;p=thirdparty%2Flibarchive.git 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. --- 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: