From: Andre Noll Date: Sat, 4 Jun 2016 14:43:43 +0000 (+0200) Subject: fd.c: Avoid gcc warning regarding fchdir(). X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=6744ce67f91c410f69de0763fb6faa01a8a53b28;p=adu.git fd.c: Avoid gcc warning regarding fchdir(). 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. --- 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);