wall: check writing to a file descriptor was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-04-13 20:55:01 +01:00 committed by Karel Zak
parent 1469971535
commit 7f587afc67
1 changed files with 2 additions and 2 deletions

View File

@ -169,7 +169,8 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
*/
if (errno == ENODEV || errno == EIO)
break;
(void) close(fd);
if (close_fd(fd) != 0)
warn(_("write failed: %s"), device);
if (forked)
_exit(EXIT_FAILURE);
if (strlen(strerror(errno)) > 1000)
@ -184,7 +185,6 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
return (errbuf);
}
(void) close(fd);
if (forked)
_exit(EXIT_SUCCESS);
return (NULL);