]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Extract ACL octal digit using mask of type 'int'
authorBrad King <brad.king@kitware.com>
Mon, 16 Nov 2009 16:28:59 +0000 (11:28 -0500)
committerBrad King <brad.king@kitware.com>
Mon, 16 Nov 2009 16:28:59 +0000 (11:28 -0500)
In archive_read_support_format_tar.c we mask a mode with ~0777777 to
erase the non-ACL octal digits.  The mode is represented by int64_t so
the compiler sign-extends the our literal mask from type int to int64_t
for application of the & operator.

Unfortunately the resulting int64_t type is not allowed in switch() on
some old compilers (like HP).  Since we are looking only for values that
fit in an int after the mask anyway, we might as well cast to int for
the entire mask operation.  This also avoids depending on the compiler
to preserve the intention of the mask with sign-extension, making the
code easier to understand anyway.

SVN-Revision: 1656

libarchive/archive_read_support_format_tar.c

index 716ecd79e40729b299912c83acd9b1b31ef23e0a..79ab246c8903b625c525cd918d855d3ff83a57a2 100644 (file)
@@ -773,7 +773,7 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
                }
                p++;
        }
-       switch (type & ~0777777) {
+       switch ((int)type & ~0777777) {
        case 01000000:
                /* POSIX.1e ACL */
                break;