]> granicus.if.org Git - procps-ng/commitdiff
top: fix unlikely edge case wherein all fields are off
authorJim Warner <james.warner@comcast.net>
Mon, 3 Aug 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Thu, 6 Aug 2015 11:56:27 +0000 (21:56 +1000)
While testing a newlib interface for pids acquisitions
I encountered some unexpected results if an idiot user
(me) turns off all displayable fields. So, this commit
ensures that the PID field will be shown as a minimum.

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 5686c136f9fa44a3dc5ec3b475779f3d0da4ad39..9d0e56aa57f59872688888645c6c1a1bc603e7dd 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -1994,6 +1994,7 @@ static void calibrate_fields (void) {
 #endif
             }
          }
+         if (!w->totpflgs) w->pflgsall[w->totpflgs++] = EU_PID;
 
          /* build a preliminary columns header not to exceed screen width
             while accounting for a possible leading window number */