Blame SOURCES/attr-2.4.44-bz660619.patch

40ba48
From c3fa3829e494c1875416058bb8d448a89f9e5e55 Mon Sep 17 00:00:00 2001
40ba48
From: Kamil Dudka <kdudka@redhat.com>
40ba48
Date: Wed, 22 Dec 2010 14:13:27 +0100
40ba48
Subject: [PATCH] getfattr: return non-zero exit code on failure
40ba48
MIME-Version: 1.0
40ba48
Content-Type: text/plain; charset=UTF-8
40ba48
Content-Transfer-Encoding: 8bit
40ba48
40ba48
reported by Jean-Pierre André at https://bugzilla.redhat.com/660619
40ba48
---
40ba48
 getfattr/getfattr.c |    7 ++++---
40ba48
 test/attr.test      |    4 ++++
40ba48
 2 files changed, 8 insertions(+), 3 deletions(-)
40ba48
40ba48
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
40ba48
index 7ced700..d8a7bc5 100644
40ba48
--- a/getfattr/getfattr.c
40ba48
+++ b/getfattr/getfattr.c
40ba48
@@ -355,6 +355,7 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
40ba48
 	     void *unused)
40ba48
 {
40ba48
 	int header_printed = 0;
40ba48
+	int err = 0;
40ba48
 
40ba48
 	if (walk_flags & WALK_TREE_FAILED) {
40ba48
 		fprintf(stderr, "%s: %s: %s\n", progname, xquote(path, "\n\r"),
40ba48
@@ -363,13 +364,13 @@ int do_print(const char *path, const struct stat *stat, int walk_flags,
40ba48
 	}
40ba48
 
40ba48
 	if (opt_name)
40ba48
-		print_attribute(path, opt_name, &header_printed);
40ba48
+		err = print_attribute(path, opt_name, &header_printed);
40ba48
 	else
40ba48
-		list_attributes(path, &header_printed);
40ba48
+		err = list_attributes(path, &header_printed);
40ba48
 
40ba48
 	if (header_printed)
40ba48
 		puts("");
40ba48
-	return 0;
40ba48
+	return err;
40ba48
 }
40ba48
 
40ba48
 void help(void)
40ba48
diff --git a/test/attr.test b/test/attr.test
40ba48
index e8f134c..10f10d0 100644
40ba48
--- a/test/attr.test
40ba48
+++ b/test/attr.test
40ba48
@@ -22,6 +22,10 @@ Try various valid and invalid names
40ba48
 	> user.name
40ba48
 	> 
40ba48
 	
40ba48
+	$ setfattr -x user.name f
40ba48
+	$ sh -c 'getfattr -n user.name f && echo zero exit code'
40ba48
+	> f: user.name: No such attribute
40ba48
+	
40ba48
 	$ setfattr -n user.n -v value f
40ba48
 	$ rm f
40ba48
 
40ba48
-- 
40ba48
1.7.3.3
40ba48