diff options
author | 2012-12-22 20:19:46 -0500 | |
---|---|---|
committer | 2012-12-24 05:57:57 -0500 | |
commit | bacf04ac2af632720ddd35bf6925f4085c790800 (patch) | |
tree | 96507cdf64c009fca9deb20329af43e187ba0d79 | |
parent | scripts/paxmodule.c: throw a PaxError when pax_getflags or set_xt_flags (diff) | |
download | elfix-bacf04ac2af632720ddd35bf6925f4085c790800.tar.gz elfix-bacf04ac2af632720ddd35bf6925f4085c790800.tar.bz2 elfix-bacf04ac2af632720ddd35bf6925f4085c790800.zip |
scripts/paxmodule.c: fix logic of finding either PT_PAX or XATTR_PAX
-rwxr-xr-x | misc/alt-revdep-pax | 2 | ||||
-rw-r--r-- | scripts/paxmodule.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/misc/alt-revdep-pax b/misc/alt-revdep-pax index 6c0c7ba..58fba3c 100755 --- a/misc/alt-revdep-pax +++ b/misc/alt-revdep-pax @@ -195,7 +195,7 @@ def print_object_linkings( object_linkings, soname2library, verbose ): sv = '%s ( %s )\n' % ( elf, elf_str_flags ) s = sv except pax.PaxError: - elf_without_flags.append(elf) + elfs_without_flags.append(elf) continue count = 0 diff --git a/scripts/paxmodule.c b/scripts/paxmodule.c index f77dabb..f329df8 100644 --- a/scripts/paxmodule.c +++ b/scripts/paxmodule.c @@ -281,7 +281,7 @@ static PyObject * pax_getflags(PyObject *self, PyObject *args) { const char *f_name; - int fd; + int fd, flags_found; uint16_t flags; char buf[FLAGS_SIZE]; @@ -308,10 +308,13 @@ pax_getflags(PyObject *self, PyObject *args) * other but not both. */ + flags_found = 0; + #ifdef PTPAX flags = get_pt_flags(fd); if( flags != UINT16_MAX ) { + flags_found = 1; memset(buf, 0, FLAGS_SIZE); bin2string4print(flags, buf); } @@ -321,6 +324,7 @@ pax_getflags(PyObject *self, PyObject *args) flags = get_xt_flags(fd); if( flags != UINT16_MAX ) { + flags_found = 1; memset(buf, 0, FLAGS_SIZE); bin2string4print(flags, buf); } @@ -328,7 +332,7 @@ pax_getflags(PyObject *self, PyObject *args) close(fd); - if( flags == UINT16_MAX ) + if( !flags_found ) { PyErr_SetString(PaxError, "pax_getflags: no PAX flags found"); return NULL; |