aboutsummaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 68c0ef1f1b0..2d2d545d825 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -1197,7 +1197,7 @@ kwboot_term_pipe(int in, int out, const char *quit, int *s)
if (buf[i] == quit[*s]) {
(*s)++;
if (!quit[*s]) {
- nin = i - *s;
+ nin = (i > *s) ? (i - *s) : 0;
break;
}
} else {
@@ -1208,7 +1208,7 @@ kwboot_term_pipe(int in, int out, const char *quit, int *s)
}
if (i == nin)
- nin -= *s;
+ nin -= (nin > *s) ? *s : nin;
}
if (kwboot_write(out, buf, nin) < 0)