From 6744ce67f91c410f69de0763fb6faa01a8a53b28 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 4 Jun 2016 16:43:43 +0200 Subject: [PATCH] fd.c: Avoid gcc warning regarding fchdir(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc-4.8.4 on Ubuntu-14.04 complains about our use of fchdir(): fd.c:181:9: warning: ignoring return value of ‘fchdir’, declared with attribute warn_unused_result [-Wunused-result] fchdir(*cwd); Silence the warning by introducing a dummy variable. The patch also fixes the indentation of the comment which explains why we ignore the return value here. --- fd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fd.c b/fd.c index 902e8f1..39e9837 100644 --- a/fd.c +++ b/fd.c @@ -176,9 +176,10 @@ int adu_opendir(const char *dirname, DIR **dir, int *cwd) if (*dir) return 1; ret = -ERRNO_TO_ERROR(errno); -/* Ignore return value of fchdir() and close(). We're busted anyway. */ - if (cwd) - fchdir(*cwd); + /* Ignore return value of fchdir() and close(). We're busted anyway. */ + if (cwd) { + int __a_unused ret2 = fchdir(*cwd); /* STFU, gcc */ + } close_cwd: if (cwd) close(*cwd); -- 2.39.5