- silence compile-time warnings

This commit is contained in:
Kamil Dudka 2010-05-11 11:34:26 +00:00
parent f5e23cd58f
commit a5a13257f5
2 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,80 @@
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 cae9c3f..1f2afe3 100644
--- a/getfattr/getfattr.c
+++ b/getfattr/getfattr.c
@@ -272,8 +272,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 f98c887..c7a1e75 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 "misc.h"
diff --git a/libmisc/walk_tree.c b/libmisc/walk_tree.c
index 2777145..b82a301 100644
--- a/libmisc/walk_tree.c
+++ b/libmisc/walk_tree.c
@@ -98,8 +98,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;

View File

@ -18,6 +18,9 @@ Patch2: attr-2.4.43-leak.patch
# prepare the test-suite for SELinux
Patch3: attr-2.4.44-tests.patch
# silence compile-time warnings
Patch4: attr-2.4.44-warnings.patch
License: GPLv2+
URL: http://oss.sgi.com/projects/xfs/
Group: System Environment/Base
@ -65,6 +68,7 @@ you'll also want to install attr.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
# test-suite helper script
install -m0755 %{SOURCE2} test/
@ -72,6 +76,11 @@ install -m0755 %{SOURCE2} test/
%build
# attr abuses libexecdir
%configure --libdir=/%{_lib} --libexecdir=%{_libdir}
# uncomment to turn on optimizations
# sed -i 's/-O2/-O0/' libtool include/builddefs
# unset CFLAGS
make %{?_smp_mflags} LIBTOOL="libtool --tag=CC"
%check
@ -137,6 +146,9 @@ rm -rf $RPM_BUILD_ROOT
/%{_lib}/libattr.so.*
%changelog
* Tue May 11 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-5
- silence compile-time warnings
* Wed Mar 10 2010 Kamil Dudka <kdudka@redhat.com> 2.2.44-4
- run the test-suite if possible