]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Cast mode constants to mode_t in case it is signed
authorBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:20 +0000 (08:15 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 11 Jan 2012 13:15:20 +0000 (08:15 -0500)
commit0889d99f1131199a293bcd0be0206982ee3a8a54
tree204be74b5ac2e45c4242ded7cac8dd2bdd6dbc1b
parent066da99412b605a5c99085aaae9ec7b2755ccaa7
Cast mode constants to mode_t in case it is signed

At least one compiler (Borland) defines mode_t as just "short" which is
signed.  This breaks code like

  switch(archive_entry_filetype(e)) {
    case AE_IFREG:
    ...
  }

if AE_IFREG and other constants have a longer signed type (int) because
sign extension of the mode_t return type from archive_entry_filetype
changes its value.  Avoid the problem by ensuring the type of the
constants matches mode_t.

SVN-Revision: 4128
libarchive/archive_entry.h