projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5da42fc
)
pgrep: match argv[0] too, not only comm; fix a bug in argv sanitization
author
Denys Vlasenko
<vda.linux@googlemail.com>
Fri, 14 Aug 2009 20:33:10 +0000
(22:33 +0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Fri, 14 Aug 2009 20:33:10 +0000
(22:33 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
procps/pgrep.c
patch
|
blob
|
history
diff --git
a/procps/pgrep.c
b/procps/pgrep.c
index aef4f229a7115eb64ad0599afd1fa19e04cbfd49..3a717ecff071ce2e4c9dd0f942f468c9e92c5c47 100644
(file)
--- a/
procps/pgrep.c
+++ b/
procps/pgrep.c
@@
-92,7
+92,7
@@
int pgrep_main(int argc UNUSED_PARAM, char **argv)
if (sid2match == 0)
sid2match = getsid(pid);
- scan_mask = PSSCAN_COMM;
+ scan_mask = PSSCAN_COMM
| PSSCAN_ARGV0
;
if (OPT_FULL)
scan_mask |= PSSCAN_ARGVN;
@@
-117,9
+117,9
@@
int pgrep_main(int argc UNUSED_PARAM, char **argv)
cmd = proc->comm;
} else {
int i = proc->argv_len;
- while (
i
) {
- if (
!cmd[i]) cmd[i] = ' ';
-
i--
;
+ while (
--i >= 0
) {
+ if (
(unsigned char)cmd[i] < ' ')
+
cmd[i] = ' '
;
}
}