pipeto: nicer way to avoid warn_unused_result

From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
This commit is contained in:
Leah Neukirchen 2024-08-20 22:08:47 +02:00
parent 6adf988980
commit c6e8c10ead

View File

@ -58,8 +58,7 @@ pipeto(const char *cmdline)
// execvp failed, write errno to parent
int e = errno;
if (write(pipe1[1], &e, sizeof e) < 0)
exit(111); // do a magic dance for gcc -Wunused-result
(void)! write(pipe1[1], &e, sizeof e);
exit(111);
} else { // in parent
close(pipe1[1]);