Quiet gcc warnings on glibc systems that use warn_unused_result for

write(2) and others.
This commit is contained in:
Todd C. Miller
2010-08-03 11:17:56 -04:00
parent 1229406720
commit 420db23714
7 changed files with 52 additions and 24 deletions

View File

@@ -639,10 +639,14 @@ pty_close(struct command_status *cstat)
const char *reason = strsignal(signo);
n = io_fds[SFD_USERTTY] != -1 ?
io_fds[SFD_USERTTY] : STDOUT_FILENO;
write(n, reason, strlen(reason));
if (WCOREDUMP(cstat->val))
write(n, " (core dumped)", 14);
write(n, "\n", 1);
if (write(n, reason, strlen(reason)) != -1) {
if (WCOREDUMP(cstat->val)) {
if (write(n, " (core dumped)", 14) == -1)
/* shut up glibc */;
}
if (write(n, "\n", 1) == -1)
/* shut up glibc */;
}
}
}
}
@@ -875,7 +879,8 @@ exec_monitor(struct command_details *details, char *argv[], char *envp[],
exec_pty(details, argv, envp);
cstat.type = CMD_ERRNO;
cstat.val = errno;
write(errpipe[1], &cstat, sizeof(cstat));
if (write(errpipe[1], &cstat, sizeof(cstat)) == -1)
/* shut up glibc */;
_exit(1);
}
close(errpipe[1]);