aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/ps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 7a8327f3..cb57ecf2 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -566,7 +566,7 @@ static void show_ps(struct carveup *tb)
abslen = abs(field->len);
sign = field->len<0 ? -1 : 1;
olen = strlen(out);
- if (field->which<=PS_BIT && olen>abslen) {
+ if ((field->which<=PS_BIT || (toys.optflags&FLAG_w)) && olen>abslen) {
// overflow but remember by how much
extra += olen-abslen;
abslen = olen;