summaryrefslogtreecommitdiff
path: root/usr.bin/top/top.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-10-16 07:33:09 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-10-16 07:33:09 +0000
commite705732a6622d536ead13ca626589e130949e712 (patch)
treeffcad1f8a2ea9d4b86b61d45e00df23c9463ffc6 /usr.bin/top/top.c
parent34c77c62d876eae153056388e21c73a29964c400 (diff)
Properly adjust headers displayed when the screen contains few lines.
Avoid a segv also. Problem reported by Mark Lumsden; inital diff by me, further polishing by Mark. Tested by ray@ canacar@ hshoexer@
Diffstat (limited to 'usr.bin/top/top.c')
-rw-r--r--usr.bin/top/top.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c
index 26181c20503..a7dde5aa677 100644
--- a/usr.bin/top/top.c
+++ b/usr.bin/top/top.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: top.c,v 1.57 2007/10/04 07:47:53 otto Exp $ */
+/* $OpenBSD: top.c,v 1.58 2007/10/16 07:33:08 otto Exp $ */
/*
* Top users/processes display for Unix
@@ -337,10 +337,8 @@ main(int argc, char *argv[])
header_text = format_header(uname_field);
/* initialize display interface */
- if ((max_topn = display_init(&statics)) == -1) {
- warnx("can't allocate sufficient memory");
- exit(4);
- }
+ max_topn = display_init(&statics);
+
/* print warning if user requested more processes than we can display */
if (topn > max_topn) {
warnx("warning: this terminal can only display %d processes",