summaryrefslogtreecommitdiff
path: root/term-utils/ttymsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'term-utils/ttymsg.c')
-rw-r--r--term-utils/ttymsg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index 66b61b491..8bf993c2f 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -41,6 +41,7 @@
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/uio.h>
#include <signal.h>
#include <fcntl.h>
@@ -169,7 +170,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 +186,6 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
return (errbuf);
}
- (void) close(fd);
if (forked)
_exit(EXIT_SUCCESS);
return (NULL);