summaryrefslogtreecommitdiffstats
path: root/term-utils/ttymsg.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:57 +0000
commitce95875445c67808caa5d4fb0e6f80dbdaef0cb7 (patch)
tree6da8cbc66ef15086c9d295e4abe733b24818551e /term-utils/ttymsg.c
parentAdding upstream version 2.40. (diff)
downloadutil-linux-upstream.tar.xz
util-linux-upstream.zip
Adding upstream version 2.40.1.upstream/2.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'term-utils/ttymsg.c')
-rw-r--r--term-utils/ttymsg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/term-utils/ttymsg.c b/term-utils/ttymsg.c
index faa0344..ef7e358 100644
--- a/term-utils/ttymsg.c
+++ b/term-utils/ttymsg.c
@@ -123,7 +123,7 @@ ttymsg(struct iovec *iov, size_t iovcnt, char *line, int tmout) {
iovcnt * sizeof(struct iovec));
iov = localiov;
}
- for (cnt = 0; wret >= (ssize_t) iov->iov_len; ++cnt) {
+ for (cnt = 0; wret >= (ssize_t) iov->iov_len && iovcnt > 0; ++cnt) {
wret -= iov->iov_len;
++iov;
--iovcnt;