1 |
commit: 8846793632c93d7fc4f7175312a025a2f194f161 |
2 |
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 26 12:20:08 2013 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Nov 7 14:48:06 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=88467936 |
7 |
|
8 |
Return EXIT_SUCCESS if user.pax.flags is done after paxctl-ng -d |
9 |
|
10 |
If the user.pax.flags field exists and we have permissions to remove |
11 |
it, the first invocation of paxctl-ng -d returns 0. But subsequently |
12 |
it returns 1 because it fails to remove an xattr field that is not |
13 |
there. We make sure we return 0 if the field is gone for whatever |
14 |
reason. We only fail upon not having permissions to change the xattr |
15 |
filed, or the filesystem not supporting xattrs (ENOTSUP). |
16 |
|
17 |
Reported-by: Maxim Kammerer <mk <AT> dee.su> |
18 |
|
19 |
X-Gentoo-Bug: 485908 |
20 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/485908 |
21 |
|
22 |
--- |
23 |
src/paxctl-ng.c | 11 ++++++++++- |
24 |
1 file changed, 10 insertions(+), 1 deletion(-) |
25 |
|
26 |
diff --git a/src/paxctl-ng.c b/src/paxctl-ng.c |
27 |
index 4d69ab4..8071d50 100644 |
28 |
--- a/src/paxctl-ng.c |
29 |
+++ b/src/paxctl-ng.c |
30 |
@@ -26,6 +26,7 @@ |
31 |
#include <sys/stat.h> |
32 |
#include <fcntl.h> |
33 |
#include <unistd.h> |
34 |
+#include <errno.h> |
35 |
|
36 |
#ifdef PTPAX |
37 |
#include <gelf.h> |
38 |
@@ -744,7 +745,15 @@ delete_xt_flags(int fd) |
39 |
if( !fremovexattr(fd, PAX_NAMESPACE) ) |
40 |
return EXIT_SUCCESS; |
41 |
else |
42 |
- return EXIT_FAILURE; |
43 |
+ { |
44 |
+ // If this fails because there was no such named xattr |
45 |
+ // in the first place, then in a sense, we succeeded. |
46 |
+ // See: https://bugs.gentoo.org/show_bug.cgi?id=485908 |
47 |
+ if( errno == ENOATTR ) |
48 |
+ return EXIT_SUCCESS; |
49 |
+ else |
50 |
+ return EXIT_FAILURE; |
51 |
+ } |
52 |
} |
53 |
#endif |