Silence unused result warnings on newer compilers

Newer versions of GCC and Clang are not satisfied by a cast to void,
this fix is adapted from glibc's solution.

New wrapper function ignore_result should be used when a function with
explicit _unused_attribute_ wrapper is called whose result will not be
handled.
This commit is contained in:
Mahmoud Al-Qudsi
2017-08-12 09:54:26 -05:00
committed by Kurtis Rader
parent 5356384d0a
commit e6bb7fc973
6 changed files with 25 additions and 12 deletions

View File

@@ -338,7 +338,7 @@ void safe_perror(const char *message) {
safe_append(buff, safe_strerror(err), sizeof buff);
safe_append(buff, "\n", sizeof buff);
(void)write(STDERR_FILENO, buff, strlen(buff));
ignore_result(write(STDERR_FILENO, buff, strlen(buff)));
errno = err;
}