547bcf6
From 7fed4441e12dc794c5eb6ae1798c8338548042ac Mon Sep 17 00:00:00 2001
547bcf6
From: Kamil Dudka <kdudka@redhat.com>
547bcf6
Date: Mon, 8 Nov 2010 10:17:02 -0500
547bcf6
Subject: [PATCH 1/2] getfattr: encode NULs properly with --encoding=text
547bcf6
547bcf6
reported by Paul Bolle at https://bugzilla.redhat.com/650539
547bcf6
---
547bcf6
 getfattr/getfattr.c |    6 ++++--
547bcf6
 1 files changed, 4 insertions(+), 2 deletions(-)
547bcf6
547bcf6
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
547bcf6
index cae9c3f..9c3de32 100644
547bcf6
--- a/getfattr/getfattr.c
547bcf6
+++ b/getfattr/getfattr.c
547bcf6
@@ -133,7 +133,7 @@ const char *encode(const char *value, size_t *size)
547bcf6
 		size_t n, extra = 0;
547bcf6
 
547bcf6
 		for (e=(char *)value; e < value + *size; e++) {
547bcf6
-			if (*e == '\n' || *e == '\r')
547bcf6
+			if (*e == '\0' || *e == '\n' || *e == '\r')
547bcf6
 				extra += 4;
547bcf6
 			else if (*e == '\\' || *e == '"')
547bcf6
 				extra++;
547bcf6
@@ -147,7 +147,9 @@ const char *encode(const char *value, size_t *size)
547bcf6
 		e = encoded;
547bcf6
 		*e++='"';
547bcf6
 		for (n = 0; n < *size; n++, value++) {
547bcf6
-			if (*value == '\n' || *value == '\r') {
547bcf6
+			if (*value == '\0' && n + 1 == *size)
547bcf6
+				break;
547bcf6
+			if (*value == '\0' || *value == '\n' || *value == '\r') {
547bcf6
 				*e++ = '\\';
547bcf6
 				*e++ = '0' + ((unsigned char)*value >> 6);
547bcf6
 				*e++ = '0' + (((unsigned char)*value & 070) >> 3);
547bcf6
-- 
547bcf6
1.7.3.3
547bcf6
547bcf6
547bcf6
From 0a2d62b62a3aef601228232ee2e0133a3bbc510b Mon Sep 17 00:00:00 2001
547bcf6
From: Andreas Gruenbacher <agruen@suse.de>
547bcf6
Date: Tue, 23 Nov 2010 16:44:55 +0100
547bcf6
Subject: [PATCH 2/2] OPTIONS in man pages should be a section heading, not a subsection heading
547bcf6
547bcf6
---
547bcf6
 man/man1/getfattr.1 |    2 +-
547bcf6
 man/man1/setfattr.1 |    2 +-
547bcf6
 2 files changed, 2 insertions(+), 2 deletions(-)
547bcf6
547bcf6
diff --git a/man/man1/getfattr.1 b/man/man1/getfattr.1
547bcf6
index 40f735d..53beb84 100644
547bcf6
--- a/man/man1/getfattr.1
547bcf6
+++ b/man/man1/getfattr.1
547bcf6
@@ -59,7 +59,7 @@ The remaining lines (lines 2 to 4 above) show the
547bcf6
 and 
547bcf6
 .I value
547bcf6
 pairs associated with the specified file.
547bcf6
-.SS OPTIONS
547bcf6
+.SH OPTIONS
547bcf6
 .TP 4
547bcf6
 .BR \-n " \f2name\f1, " \-\-name "=\f2name\f1"
547bcf6
 Dump the value of the named extended attribute extended attribute.
547bcf6
diff --git a/man/man1/setfattr.1 b/man/man1/setfattr.1
547bcf6
index 2d33f50..ee54e06 100644
547bcf6
--- a/man/man1/setfattr.1
547bcf6
+++ b/man/man1/setfattr.1
547bcf6
@@ -40,7 +40,7 @@ command associates a new
547bcf6
 with an extended attribute
547bcf6
 .IR name
547bcf6
 for each specified file.
547bcf6
-.SS OPTIONS
547bcf6
+.SH OPTIONS
547bcf6
 .TP 4
547bcf6
 .BR \-n " \f2name\f1, " \-\-name "=\f2name\f1"
547bcf6
 Specifies the name of the extended attribute to set.
547bcf6
-- 
547bcf6
1.7.3.3
547bcf6