]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Correct handling user_umask in create_filesystem_object function.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 30 Oct 2012 23:47:36 +0000 (08:47 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 30 Oct 2012 23:47:36 +0000 (08:47 +0900)
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
libarchive/archive_write_disk_windows.c

index 8ae02a8ebd31290e9592287892bd27cc1b75eb4c..81458b39885fb796c015bd52e139d5cad9e8f0da 100644 (file)
@@ -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:
index 39fd65fa0b8f2da7ab70039f4ed2b71d1a060bb5..0f0780a8e47e1bc4e009df4d87b65494d9b71b24 100644 (file)
@@ -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: