Blob Blame History Raw
From b01c9a5805632167acc4c669852093555bfc10ae Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Tue, 19 Apr 2011 08:48:53 +0200
Subject: [PATCH] fix compile-time warnings in attr-2.4.45

---
 attr/attr.c         |   10 ++++++++--
 getfattr/getfattr.c |    6 ++++--
 libmisc/quote.c     |    1 +
 libmisc/walk_tree.c |    4 ++--
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/attr/attr.c b/attr/attr.c
index e4a8272..2b1ba6a 100644
--- a/attr/attr.c
+++ b/attr/attr.c
@@ -173,9 +173,11 @@ main(int argc, char **argv)
 			exit(1);
 		}
 		if (verbose) {
+			int sink;
 			printf(_("Attribute \"%s\" set to a %d byte value "
 			       "for %s:\n"), attrname, attrlength, filename);
-			fwrite(attrvalue, 1, attrlength, stdout);
+			sink = fwrite(attrvalue, 1, attrlength, stdout);
+			(void) sink;
 			printf("\n");
 		}
 		break;
@@ -199,7 +201,11 @@ main(int argc, char **argv)
 			printf(_("Attribute \"%s\" had a %d byte value "
 				"for %s:\n"), attrname, attrlength, filename);
 		}
-		fwrite(attrvalue, 1, attrlength, stdout);
+		{
+			/* silence compiler's warning */
+			int sink = fwrite(attrvalue, 1, attrlength, stdout);
+			(void) sink;
+		}
 		if (verbose) {
 			printf("\n");
 		}
diff --git a/getfattr/getfattr.c b/getfattr/getfattr.c
index 9c3de32..7ced700 100644
--- a/getfattr/getfattr.c
+++ b/getfattr/getfattr.c
@@ -274,8 +274,10 @@ int print_attribute(const char *path, const char *name, int *header_printed)
 		*header_printed = 1;
 	}
 
-	if (opt_value_only)
-		fwrite(value, length, 1, stdout);
+	if (opt_value_only) {
+		int sink = fwrite(value, length, 1, stdout);
+		(void) sink;
+        }
 	else if (length) {
 		const char *enc = encode(value, &length);
 		
diff --git a/libmisc/quote.c b/libmisc/quote.c
index bf8f9eb..8835af4 100644
--- a/libmisc/quote.c
+++ b/libmisc/quote.c
@@ -19,6 +19,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <ctype.h>
 #include <string.h>
 #include "misc.h"
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
index 30ff92a..b87c35c 100644
--- a/libmisc/walk_tree.c
+++ b/libmisc/walk_tree.c
@@ -100,8 +100,8 @@ static int walk_tree_rec(const char *path, int walk_flags,
 	 *      a dir not from a symlink
 	 *      a link and follow_symlinks
 	 */
-        if ((flags & WALK_TREE_RECURSIVE) &&
-	   (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode)) ||
+        if (((flags & WALK_TREE_RECURSIVE) &&
+	   (!(flags & WALK_TREE_SYMLINK) && S_ISDIR(st.st_mode))) ||
 	   ((flags & WALK_TREE_SYMLINK) && follow_symlinks)) {
 		struct dirent *entry;
 
-- 
1.7.4.2