pgrep: Don't segfault with no match
If pgrep is run with a non-program name match and there are
no matches, it segfaults.
The testsuite thinks zero bytes sent, and zero bytes sent
because the program crashed is the same :/
References:
commit 1aacf4af7f
https://bugs.debian.org/894917
Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
parent
2fc2427ed3
commit
0b488c7f5c
4
NEWS
4
NEWS
@ -1,3 +1,7 @@
|
|||||||
|
procps-ng-3.3.14
|
||||||
|
----------------
|
||||||
|
* pgrep: Don't segfault on non match Debian #894917
|
||||||
|
|
||||||
procps-ng-3.3.13
|
procps-ng-3.3.13
|
||||||
----------------
|
----------------
|
||||||
* library: Increment to 7:0:1
|
* library: Increment to 7:0:1
|
||||||
|
2
pgrep.c
2
pgrep.c
@ -652,7 +652,7 @@ static struct el * select_procs (int *num)
|
|||||||
closeproc (ptp);
|
closeproc (ptp);
|
||||||
*num = matches;
|
*num = matches;
|
||||||
|
|
||||||
if ((!matches) && (!opt_full) && (strlen(opt_pattern) > 15))
|
if ((!matches) && (!opt_full) && opt_pattern && (strlen(opt_pattern) > 15))
|
||||||
xwarnx(_("pattern that searches for process name longer than 15 characters will result in zero matches\n"
|
xwarnx(_("pattern that searches for process name longer than 15 characters will result in zero matches\n"
|
||||||
"Try `%s -f' option to match against the complete command line."),
|
"Try `%s -f' option to match against the complete command line."),
|
||||||
program_invocation_short_name);
|
program_invocation_short_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user