]> granicus.if.org Git - procps-ng/commitdiff
top: adjust some parenthesis for correct '^N' behavior
authorJim Warner <james.warner@comcast.net>
Thu, 16 Jun 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Mon, 20 Jun 2022 09:18:02 +0000 (19:18 +1000)
Some kdeinit tasks have a large environment consisting
mostly of nulls which were then followed by one or two
printable characters. Such strange environments should
not be shown with that 'not applicable' (n/a) notation
even though that first string vector is equal to '\0'.

I thought I had covered such a contingency but, due to
a misplaced right parenthesis, that '^N' bottom window
could see 'n/a' + a bunch of spaces + printable stuff.

Well, that won't happen anymore with this tiny change.

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

index 9f8d5d30ceeba06d89e95531141df4b3e3a217a4..0629593b25fd90edf96a2ff6382667ed6efbf130 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5061,7 +5061,7 @@ static int bot_focus_strv (const char *hdr, const char **strv) {
       n = (char *)&strv[0] - strv[0];
       if (n >= sizeof(Bot_buf)) n = sizeof(Bot_buf) - 1;
       memcpy(Bot_buf, strv[0], n);
-      if (!Bot_buf[0] || (!strcmp(Bot_buf, "-") && n <= sizeof(char *)))
+      if ((!Bot_buf[0] || !strcmp(Bot_buf, "-")) && n <= sizeof(char *))
          strcpy(Bot_buf, N_txt(X_BOT_nodata_txt));
       for (nsav= 0, p = Bot_buf, x = 0; strv[nsav] != NULL; nsav++) {
          p += strlen(strv[nsav]) + 1;