Discussion:
[PATCH] same: pacify gcc -Wunused-variable
(too old to reply)
Paul Eggert
2018-02-23 21:04:20 UTC
Permalink
* lib/same.c (same_nameat) [!CHECK_TRUNCATION]:
Omit unused variable.
---
ChangeLog | 4 ++++
lib/same.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 50a3bb568..bc80d0099 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2018-02-23 Paul Eggert <***@cs.ucla.edu>

+ same: pacify gcc -Wunused-variable
+ * lib/same.c (same_nameat) [!CHECK_TRUNCATION]:
+ Omit unused variable.
+
malloca: pacify gcc -Wbad-function-cast
* lib/malloca.h (malloca): Pacify gcc -Wbad-function-cast
diagnostic that I got on Fedora 27 with gcc 7.3.1 20180130.
diff --git a/lib/same.c b/lib/same.c
index 47b50be96..37420172c 100644
--- a/lib/same.c
+++ b/lib/same.c
@@ -105,9 +105,9 @@ same_nameat (int source_dfd, char const *source,
free (source_dirname);

char *dest_dirname = dir_name (dest);
- int destdir_errno = 0;

#if CHECK_TRUNCATION
+ int destdir_errno = 0;
int open_flags = O_SEARCH | O_CLOEXEC | O_DIRECTORY;
int destdir_fd = openat (dest_dfd, dest_dirname, open_flags);
if (destdir_fd < 0 || fstat (destdir_fd, &dest_dir_stats) != 0)
--
2.14.3
Loading...