aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-06-07 17:41:22 -0700
committerRob Landley <rob@landley.net>2021-06-09 00:26:37 -0500
commit7ee66e9aec520afa1138876074b815295b6d1821 (patch)
tree92b994774e90318a487f012e5d95164a61e656d6 /toys
parentdf63d49f9f661cb48a082a993770c9ba4d76c744 (diff)
downloadtoybox-7ee66e9aec520afa1138876074b815295b6d1821.tar.gz
dmesg.c: fix off-by-one.
Diffstat (limited to 'toys')
-rw-r--r--toys/lsb/dmesg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/lsb/dmesg.c b/toys/lsb/dmesg.c
index 829fcd54..8736a8e5 100644
--- a/toys/lsb/dmesg.c
+++ b/toys/lsb/dmesg.c
@@ -141,7 +141,7 @@ void dmesg_main(void)
for (;;) {
// why does /dev/kmesg return EPIPE instead of EAGAIN if oldest message
// expires as we read it?
- if (-1==(len = read(fd, msg, sizeof(msg))) && errno==EPIPE) continue;
+ if (-1==(len = read(fd, msg, sizeof(msg)-1)) && errno==EPIPE) continue;
// read() from kmsg always fails on a pre-3.5 kernel.
if (len==-1 && errno==EINVAL) goto klogctl_mode;
if (len<1) break;