From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-537697-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 4CA071381F3
	for <garchives@archives.gentoo.org>; Sun, 23 Dec 2012 03:50:29 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5E8D6E05DD;
	Sun, 23 Dec 2012 03:49:36 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B558221C033
	for <gentoo-commits@lists.gentoo.org>; Sun, 23 Dec 2012 03:49:35 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 63B6233DACB
	for <gentoo-commits@lists.gentoo.org>; Sun, 23 Dec 2012 03:49:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 04D5DE5444
	for <gentoo-commits@lists.gentoo.org>; Sun, 23 Dec 2012 03:49:33 +0000 (UTC)
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" <blueness@gentoo.org>
Message-ID: <1356234519.38d458a4ca02f218dbb4d292007368209c635625.blueness@gentoo>
Subject: [gentoo-commits] proj/elfix:master commit in: scripts/
X-VCS-Repository: proj/elfix
X-VCS-Files: scripts/paxmodule.c
X-VCS-Directories: scripts/
X-VCS-Committer: blueness
X-VCS-Committer-Name: Anthony G. Basile
X-VCS-Revision: 38d458a4ca02f218dbb4d292007368209c635625
X-VCS-Branch: master
Date: Sun, 23 Dec 2012 03:49:33 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 1e206759-d64f-4bc4-9bb0-bce0f41a7555
X-Archives-Hash: 3dc86d2e118e3ef4b7c0ef1579fff23c

commit:     38d458a4ca02f218dbb4d292007368209c635625
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 23 01:04:04 2012 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Dec 23 03:48:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=38d458a4

scripts/paxmodule.c: throw a PaxError when pax_getflags or set_xt_flags

---
 scripts/paxmodule.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/paxmodule.c b/scripts/paxmodule.c
index 469e0cb..f77dabb 100644
--- a/scripts/paxmodule.c
+++ b/scripts/paxmodule.c
@@ -328,7 +328,13 @@ pax_getflags(PyObject *self, PyObject *args)
 
 	close(fd);
 
-	return Py_BuildValue("si", buf, flags);
+	if( flags == UINT16_MAX )
+	{
+		PyErr_SetString(PaxError, "pax_getflags: no PAX flags found");
+		return NULL;
+	}
+	else
+		return Py_BuildValue("si", buf, flags);
 }
 
 
@@ -488,7 +494,14 @@ set_xt_flags(int fd, uint16_t xt_flags)
 
 	memset(buf, 0, FLAGS_SIZE);
 	bin2string(xt_flags, buf);
-	fsetxattr(fd, PAX_NAMESPACE, buf, strlen(buf), 0);
+
+	if( fsetxattr(fd, PAX_NAMESPACE, buf, strlen(buf), 0))
+	{
+		PyErr_SetString(PaxError, "pax_deletextpax: fremovexattr() failed");
+		return;
+	}
+	else
+		return;
 }
 #endif