summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-12-01 11:01:41 -0800
committerJim Meyering <meyering@fb.com>2014-12-01 11:07:16 -0800
commit383efa5436d98f3eec6ad6f37b52013cee0a14b9 (patch)
tree22c4c59364f1d8a72a1f48ec8f50f9d2fc0d2f64
parent671770af8b0aa7829b1e7a032f16e9cced5d00a8 (diff)
downloadsed-383efa5436d98f3eec6ad6f37b52013cee0a14b9.tar.gz
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.
-rw-r--r--.gitignore2
-rw-r--r--bootstrap.conf1
-rw-r--r--lib/.gitignore1
-rw-r--r--sed/execute.c5
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,