40ba48
From b01c9a5805632167acc4c669852093555bfc10ae Mon Sep 17 00:00:00 2001
40ba48
From: Kamil Dudka <kdudka@redhat.com>
40ba48
Date: Tue, 19 Apr 2011 08:48:53 +0200
40ba48
Subject: [PATCH] fix compile-time warnings in attr-2.4.45
40ba48
40ba48
---
40ba48
 attr/attr.c         |   10 ++++++++--
40ba48
 getfattr/getfattr.c |    6 ++++--
40ba48
 libmisc/quote.c     |    1 +
40ba48
 libmisc/walk_tree.c |    4 ++--
40ba48
 4 files changed, 15 insertions(+), 6 deletions(-)
40ba48
40ba48
diff --git a/attr/attr.c b/attr/attr.c
40ba48
index e4a8272..2b1ba6a 100644
40ba48
--- a/attr/attr.c
40ba48
+++ b/attr/attr.c
40ba48
@@ -173,9 +173,11 @@ main(int argc, char **argv)
40ba48
 			exit(1);
40ba48
 		}
40ba48
 		if (verbose) {
40ba48
+			int sink;
40ba48
 			printf(_("Attribute \"%s\" set to a %d byte value "
40ba48
 			       "for %s:\n"), attrname, attrlength, filename);
40ba48
-			fwrite(attrvalue, 1, attrlength, stdout);
40ba48
+			sink = fwrite(attrvalue, 1, attrlength, stdout);
40ba48
+			(void) sink;
40ba48
 			printf("\n");
40ba48
 		}
40ba48
 		break;
40ba48
@@ -199,7 +201,11 @@ main(int argc, char **argv)
40ba48
 			printf(_("Attribute \"%s\" had a %d byte value "
40ba48
 				"for %s:\n"), attrname, attrlength, filename);
40ba48
 		}
40ba48
-		fwrite(attrvalue, 1, attrlength, stdout);
40ba48
+		{
40ba48
+			/* silence compiler's warning */
40ba48
+			int sink = fwrite(attrvalue, 1, attrlength, stdout);
40ba48
+			(void) sink;
40ba48
+		}
40ba48
 		if (verbose) {
40ba48
 			printf("\n");
40ba48
 		}
40ba48
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
40ba48
index 9c3de32..7ced700 100644
40ba48
--- a/getfattr/getfattr.c
40ba48
+++ b/getfattr/getfattr.c
40ba48
@@ -274,8 +274,10 @@ int print_attribute(const char *path, const char *name, int *header_printed)
40ba48
 		*header_printed = 1;
40ba48
 	}
40ba48
 
40ba48
-	if (opt_value_only)
40ba48
-		fwrite(value, length, 1, stdout);
40ba48
+	if (opt_value_only) {
40ba48
+		int sink = fwrite(value, length, 1, stdout);
40ba48
+		(void) sink;
40ba48
+        }
40ba48
 	else if (length) {
40ba48
 		const char *enc = encode(value, &length);
40ba48
 		
40ba48
diff --git a/libmisc/quote.c b/libmisc/quote.c
40ba48
index bf8f9eb..8835af4 100644
40ba48
--- a/libmisc/quote.c
40ba48
+++ b/libmisc/quote.c
40ba48
@@ -19,6 +19,7 @@
40ba48
 
40ba48
 #include <stdio.h>
40ba48
 #include <stdlib.h>
40ba48
+#include <string.h>
40ba48
 #include <ctype.h>
40ba48
 #include <string.h>
40ba48
 #include "misc.h"
40ba48
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
40ba48
index 30ff92a..b87c35c 100644
40ba48
--- a/libmisc/walk_tree.c
40ba48
+++ b/libmisc/walk_tree.c
40ba48
@@ -100,8 +100,8 @@ static int walk_tree_rec(const char *path, int walk_flags,
40ba48
 	 *      a dir not from a symlink
40ba48
 	 *      a link and follow_symlinks
40ba48
 	 */
40ba48
-        if ((flags & WALK_TREE_RECURSIVE) &&
40ba48
-	   (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
40ba48
+        if (((flags & WALK_TREE_RECURSIVE) &&
40ba48
+	   (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode))) ||
40ba48
 	   ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
40ba48
 		struct dirent *entry;
40ba48
 
40ba48
-- 
40ba48
1.7.4.2
40ba48