aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2012-12-22 20:19:46 -0500
committerAnthony G. Basile <blueness@gentoo.org>2012-12-22 22:48:39 -0500
commite31338bf0de64f367f0d1760035019a9a1e147de (patch)
tree8dad98bd06a315c13fcc13c21350f6648c62e328 /scripts
parentscripts/paxmodule.c: throw a PaxError when pax_getflags or set_xt_flags (diff)
downloadelfix-e31338bf0de64f367f0d1760035019a9a1e147de.tar.gz
elfix-e31338bf0de64f367f0d1760035019a9a1e147de.tar.bz2
elfix-e31338bf0de64f367f0d1760035019a9a1e147de.zip
scripts/paxmodule.c: fix logic of finding either PT_PAX or XATTR_PAX
Diffstat (limited to 'scripts')
-rw-r--r--scripts/paxmodule.c8
1 files changed, 6 insertions, 2 deletions
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;