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.
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);