From: Brad King Date: Mon, 16 Nov 2009 16:28:59 +0000 (-0500) Subject: Extract ACL octal digit using mask of type 'int' X-Git-Tag: v2.8.0~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b16468499e57e1b8768ec0f23f54f65d998bfb9c;p=thirdparty%2Flibarchive.git Extract ACL octal digit using mask of type 'int' 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 --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index 716ecd79e..79ab246c8 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -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;