diff options
author | Ron Yorston <rmy@pobox.com> | 2015-10-31 17:13:47 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-10-31 17:13:47 +0000 |
commit | 4432dbba6559d3d88e18ecf2c33d9e5a39e82074 (patch) | |
tree | f6db886523a04e0b45926336223ff8c32761dc43 /libbb/procps.c | |
parent | bc09f29f78547856e2152dc47051aeed548f28e8 (diff) | |
parent | 6bd3fff51aa74e2ee2d87887b12182a3b09792ef (diff) | |
download | busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.tar.gz busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.tar.bz2 busybox-w32-4432dbba6559d3d88e18ecf2c33d9e5a39e82074.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/procps.c')
-rw-r--r-- | libbb/procps.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libbb/procps.c b/libbb/procps.c index 5a4ea59d0..452b50b82 100644 --- a/libbb/procps.c +++ b/libbb/procps.c | |||
@@ -589,12 +589,14 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) | |||
589 | buf[sz] = ' '; | 589 | buf[sz] = ' '; |
590 | sz--; | 590 | sz--; |
591 | } | 591 | } |
592 | if (base[0] == '-') /* "-sh" (login shell)? */ | ||
593 | base++; | ||
592 | 594 | ||
593 | /* If comm differs from argv0, prepend "{comm} ". | 595 | /* If comm differs from argv0, prepend "{comm} ". |
594 | * It allows to see thread names set by prctl(PR_SET_NAME). | 596 | * It allows to see thread names set by prctl(PR_SET_NAME). |
595 | */ | 597 | */ |
596 | if (base[0] == '-') /* "-sh" (login shell)? */ | 598 | if (!comm) |
597 | base++; | 599 | return; |
598 | comm_len = strlen(comm); | 600 | comm_len = strlen(comm); |
599 | /* Why compare up to comm_len, not COMM_LEN-1? | 601 | /* Why compare up to comm_len, not COMM_LEN-1? |
600 | * Well, some processes rewrite argv, and use _spaces_ there | 602 | * Well, some processes rewrite argv, and use _spaces_ there |
@@ -613,7 +615,7 @@ void FAST_FUNC read_cmdline(char *buf, int col, unsigned pid, const char *comm) | |||
613 | buf[col - 1] = '\0'; | 615 | buf[col - 1] = '\0'; |
614 | } | 616 | } |
615 | } else { | 617 | } else { |
616 | snprintf(buf, col, "[%s]", comm); | 618 | snprintf(buf, col, "[%s]", comm ? comm : "?"); |
617 | } | 619 | } |
618 | } | 620 | } |
619 | 621 | ||