From 148a0c3760bfd6f03152f44422a48b37a4a9f393 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 23 May 2016 10:34:01 -0700 Subject: Fix pkill -9. This fixes the existing test. Internal Android bug 28877702. I've left -l as-is, even though the desktop doesn't support that. --- toys/posix/ps.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'toys') diff --git a/toys/posix/ps.c b/toys/posix/ps.c index a62918ce..e5adc192 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -48,7 +48,7 @@ USE_PS(NEWTOY(ps, "k(sort)*P(ppid)*aAdeflMno*O*p(pid)*s*t*Tu*U*g*G*wZ[!ol][+Ae][ USE_TOP(NEWTOY(top, ">0m" "O*Hk*o*p*u*s#<1d#=3<1n#<1bq[!oO]", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_LOCALE)) USE_IOTOP(NEWTOY(iotop, ">0AaKO" "k*o*p*u*s#<1=7d#=3<1n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_STAYROOT|TOYFLAG_LOCALE)) USE_PGREP(NEWTOY(pgrep, "?cld:u*U*t*s*P*g*G*fnovxL:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) -USE_PKILL(NEWTOY(pkill, "Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_PKILL(NEWTOY(pkill, "?Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) config PS bool "ps" @@ -194,9 +194,9 @@ config PKILL default y depends on PGKILL_COMMON help - usage: pkill [-l SIGNAL] [PATTERN] + usage: pkill [-SIGNAL|-l SIGNAL] [PATTERN] - -l SIGNAL to send + -l Send SIGNAL (default SIGTERM) -V verbose config PGKILL_COMMON @@ -1725,6 +1725,9 @@ void pgrep_main(void) void pkill_main(void) { + char **args = toys.optargs; + + if (!(toys.optflags&FLAG_l) && *args && **args=='-') TT.pgrep.L = *(args++)+1; if (!TT.pgrep.L) TT.pgrep.signal = SIGTERM; if (toys.optflags & FLAG_V) TT.tty = 1; pgrep_main(); -- cgit v1.2.3