aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Walle <bernhard@bwalle.de>2013-02-28 12:42:38 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-02-28 12:42:38 +0100
commit47f8558eee4caa30078daaa669f37d7cc77163fd (patch)
treee357192d977ca9c6dedf25d83badebff4e20dfb0
parented954b68552efb0c496f01fc9de28a4adf0f2404 (diff)
downloadbusybox-w32-47f8558eee4caa30078daaa669f37d7cc77163fd.tar.gz
busybox-w32-47f8558eee4caa30078daaa669f37d7cc77163fd.tar.bz2
busybox-w32-47f8558eee4caa30078daaa669f37d7cc77163fd.zip
pgrep: fix -x option
Because when -x is used (exact match), then we cannot compile the regular expression with REG_NOSUB. The manual page regcomp(3) states in section "Byte offsets": Unless REG_NOSUB was set for the compilation of the pattern buffer, it is possible to obtain substring match addressing information. The problem was detected on an ARM system with glibc 2.16. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--procps/pgrep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/procps/pgrep.c b/procps/pgrep.c
index dc7ffff48..7616027b7 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -128,7 +128,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
128 bb_show_usage(); 128 bb_show_usage();
129 129
130 if (argv[0]) 130 if (argv[0])
131 xregcomp(&re_buffer, argv[0], REG_EXTENDED | REG_NOSUB); 131 xregcomp(&re_buffer, argv[0], OPT_ANCHOR ? REG_EXTENDED : (REG_EXTENDED|REG_NOSUB);
132 132
133 matched_pid = 0; 133 matched_pid = 0;
134 cmd_last = NULL; 134 cmd_last = NULL;