Re: heads-up: 38 cleanup-maint patches

Jim Meyering <[email protected]> Mon, 1 Dec 2014 11:10:03 -0800
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <CA+8g5KHvZxv1kfyB_viztBt-2bfYq=Z7-D=yN+gxRTz655x7bw@mail.gmail.com>
On Sun, Nov 30, 2014 at 9:40 PM, Jim Meyering <[email protected]> wrote:
> I will soon push the following clean-up patches.
> It was nearly 400KBuncompressed, so I'm attaching the compressed version:
>
>       maint: update bootstrap from gnulib
...

One more, to avoid a gcc warning when building with
--enable-gcc-warnings on modern systems:
0001-build-avoid-warning-about-unused-fchown-result.patch (application/octet-stream, 2.1 KB)
From c27ade4871356d072dbe83b13ab301e9ec4d1113 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 1 Dec 2014 11:01:41 -0800
Subject: [PATCH] build: avoid warning about unused fchown result

* sed/execute.c: Include "ignore-value.h".
(closedown): Explicitly ignore fchown return value.
* bootstrap.conf (gnulib_modules): Add ignore-value.
* lib/.gitignore: Ignore the new .h file.
* .gitignore: Ignore all **~ backup files.
---
 .gitignore     | 2 +-
 bootstrap.conf | 1 +
 lib/.gitignore | 1 +
 sed/execute.c  | 5 ++++-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 276baed..cf150a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@
 *.exe
 *.o
 */.deps/
-*~
+**~
 +*
 /gnulib-tests/*
 !/gnulib-tests/Makefile.am
diff --git a/bootstrap.conf b/bootstrap.conf
index 5253703..3da90f4 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -33,6 +33,7 @@ getopt
 gettext-h
 git-version-gen
 gitlog-to-changelog
+ignore-value
 localcharset
 manywarnings
 mbrlen
diff --git a/lib/.gitignore b/lib/.gitignore
index 95015bc..5920eb0 100644
--- a/lib/.gitignore
+++ b/lib/.gitignore
@@ -208,3 +208,4 @@ xstrndup.c
 xstrndup.h
 /progname.c
 /progname.h
+/ignore-value.h
diff --git a/sed/execute.c b/sed/execute.c
index 7fe8bab..fa6fe1d 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -37,6 +37,7 @@
 #include <selinux/selinux.h>
 #include <selinux/context.h>
 #include "acl.h"
+#include "ignore-value.h"
 
 #ifdef __GNUC__
 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__-0 >= 7)
@@ -645,8 +646,10 @@ closedown(struct input *input)
       input_fd = fileno (input->fp);
       output_fd = fileno (output_file.fp);
 #ifdef HAVE_FCHOWN
+      /* Try to set both UID and GID, but if that fails,
+         try to set only the GID.  Ignore failure.  */
       if (fchown (output_fd, input->st.st_uid, input->st.st_gid) == -1)
-        fchown (output_fd, -1, input->st.st_gid);
+        ignore_value (fchown (output_fd, -1, input->st.st_gid));
 #endif
       copy_acl (input->in_file_name, input_fd,
                 input->out_file_name, output_fd,
-- 
1.8.1