summaryrefslogtreecommitdiffstats
path: root/term-utils/ttymsg.c
diff options
context:
space:
mode:
authorSami Kerola2013-04-13 21:55:01 +0200
committerKarel Zak2013-04-26 13:26:07 +0200
commit7f587afc671cdbcc9712309ae779c3e309d55c32 (patch)
treedbfdfc3af8eedfa953ea7d4ba5781f7af003263d /term-utils/ttymsg.c
parentswapon: check writing to a file descriptor was successful (diff)
downloadkernel-qcow2-util-linux-7f587afc671cdbcc9712309ae779c3e309d55c32.tar.gz
kernel-qcow2-util-linux-7f587afc671cdbcc9712309ae779c3e309d55c32.tar.xz
kernel-qcow2-util-linux-7f587afc671cdbcc9712309ae779c3e309d55c32.zip
wall: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'term-utils/ttymsg.c')
-rw-r--r--term-utils/ttymsg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index 66b61b491..d6108266d 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -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);