]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
wall: check writing to a file descriptor was successful
authorSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2013 19:55:01 +0000 (20:55 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Apr 2013 11:26:07 +0000 (13:26 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils/ttymsg.c

index 66b61b49159df5c1f5fdd69c92120353fcf912f7..d6108266d2ae4f4d072b5bd71e5501e1f72010ee 100644 (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);