aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-02-16 16:24:09 -0600
committerRob Landley <rob@landley.net>2019-02-16 16:24:09 -0600
commit9197c0ae1d5206f74284018c78538a38375af3c1 (patch)
treef8cee889aa277d826e1ffb278382d951c61df6cd
parentc81f9151fec1e8f07fb039b2580c1a1b47e506f6 (diff)
downloadtoybox-9197c0ae1d5206f74284018c78538a38375af3c1.tar.gz
Disallow -o "" in top.
-rw-r--r--toys/posix/ps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 2e5338ea..279a947a 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1448,11 +1448,12 @@ static void top_common(
} plist[2], *plold, *plnew, old, new, mix;
char scratch[16], *pos, *cpufields[] = {"user", "nice", "sys", "idle",
"iow", "irq", "sirq", "host"};
-
unsigned tock = 0;
int i, lines, topoff = 0, done = 0;
char stdout_buf[BUFSIZ];
+ if (!TT.fields) perror_exit("no -o");
+
// Avoid flicker and hide the cursor in interactive mode.
if (!FLAG(b)) {
setbuf(stdout, stdout_buf);