From 383efa5436d98f3eec6ad6f37b52013cee0a14b9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 1 Dec 2014 11:01:41 -0800 Subject: 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 #include #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, -- cgit v1.2.1