Permalink
Browse files

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.
  • Loading branch information...
ggcueroad committed Oct 30, 2012
1 parent fe61ff6 commit 6027a837f2271ad28b1e47c798687368b870842e
Showing with 2 additions and 2 deletions.
  1. +1 −1 libarchive/archive_write_disk_posix.c
  2. +1 −1 libarchive/archive_write_disk_windows.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:
@@ -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:

0 comments on commit 6027a83

Please sign in to comment.