]> granicus.if.org Git - procps-ng/commitdiff
top: fix pid value displayed when kill default applies
authorJim Warner <james.warner@comcast.net>
Wed, 5 Dec 2012 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@enc.com.au>
Tue, 11 Dec 2012 11:54:24 +0000 (22:54 +1100)
Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 4a5a4d6f18c9b69145cc70b95fc714f94f115f59..74490213cdc9993bb403636a765ba654b08ad3fa 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -3760,8 +3760,9 @@ static void keys_global (int ch) {
          } else {
             int pid, sig = SIGTERM, def = w->ppt[w->begtask]->tid;
             if (GET_INT_BAD < (pid = get_int(fmtmk(N_txt(GET_pid2kill_fmt), def)))) {
-               char *str = linein(fmtmk(N_fmt(GET_sigs_num_fmt), pid, SIGTERM));
+               char *str;
                if (0 > pid) pid = def;
+               str = linein(fmtmk(N_fmt(GET_sigs_num_fmt), pid, SIGTERM));
                if (*str) sig = signal_name_to_number(str);
                if (0 < sig && kill(pid, sig))
                   show_msg(fmtmk(N_fmt(FAIL_signals_fmt)