[PATCH] build: work around -Wunused-result warning in copy-file.c

Jim Meyering jim at meyering.net
Fri Mar 4 07:33:17 UTC 2011


FYI, I've just pushed this fix:

Without this change, ./configure --enable-gcc-warnings && make
would fail due to the warning-inducing code pulled from gnulib.


>From b0019552e333950ee6bcd971fddb672cf6670bf1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Fri, 4 Mar 2011 08:03:27 +0100
Subject: [PATCH] build: work around -Wunused-result warning in copy-file.c

Without this change, ./configure --enable-gcc-warnings && make
would fail due to the warning-inducing code pulled from gnulib.
* gl/lib/copy-file.c.diff: New file, to make bootstrap (via
gnulib-tool) automatically patch gnulib's copy-file.c,
while we wait for it to be fixed in gnulib proper.
---
 gl/lib/copy-file.c.diff |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 gl/lib/copy-file.c.diff

diff --git a/gl/lib/copy-file.c.diff b/gl/lib/copy-file.c.diff
new file mode 100644
index 0000000..5fe69b5
--- /dev/null
+++ b/gl/lib/copy-file.c.diff
@@ -0,0 +1,33 @@
+From 5d96323f5cf9b4b4b52ae0b40d5c6ce7a4dfcd29 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering at redhat.com>
+Date: Tue, 1 Mar 2011 15:20:33 +0100
+Subject: [PATCH] copy-file: ignore warning about chown's unused return value
+
+* lib/copy-file.c: Include "ignore-value.h".
+(copy_file_preserving): Ignore chown failure.
+---
+ ChangeLog         |    7 +++++++
+ lib/copy-file.c   |    3 ++-
+ 3 files changed, 10 insertions(+), 1 deletions(-)
+
+diff --git a/lib/copy-file.c b/lib/copy-file.c
+index f9cd9c0..27a35c2 100644
+--- a/lib/copy-file.c
++++ b/lib/copy-file.c
+@@ -42,6 +42,7 @@
+ #include "acl.h"
+ #include "binary-io.h"
+ #include "gettext.h"
++#include "ignore-value.h"
+ #include "xalloc.h"
+
+ #define _(str) gettext (str)
+@@ -117,7 +118,7 @@ copy_file_preserving (const char *src_filename, const char *dest_filename)
+
+ #if HAVE_CHOWN
+   /* Preserve the owner and group.  */
+-  chown (dest_filename, statbuf.st_uid, statbuf.st_gid);
++  ignore_value (chown (dest_filename, statbuf.st_uid, statbuf.st_gid));
+ #endif
+
+   /* Preserve the access permissions.  */
--
1.7.4.1.21.g4cc62


More information about the iwhd-devel mailing list