]> granicus.if.org Git - procps-ng/commitdiff
pgrep fails to show full command line with -au
authorElliott Forney <elliott.forney@gmail.com>
Thu, 30 Jan 2014 10:36:26 +0000 (21:36 +1100)
committerCraig Small <csmall@enc.com.au>
Thu, 30 Jan 2014 10:36:26 +0000 (21:36 +1100)
pgrep does not show the full command line when the -a and -u flags are
combined. The -a flag is ignored when the -u flag is used as well.

In addition, the supplied patch by Elliot did not fix the problem
when invert flag ( -v ) was used; a very small tweak to the patch
fixed this problem as well. This problem existed before.

Signed-off-by: Craig Small <csmall@enc.com.au>
pgrep.c

diff --git a/pgrep.c b/pgrep.c
index 93a7c893467c762f43cb87b6008f7cd9e48ea859..2a0ee19b31c494be63aeb03dded3107dbc59a5e5 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -417,7 +417,7 @@ static PROCTAB *do_openproc (void)
        PROCTAB *ptp;
        int flags = 0;
 
-       if (opt_pattern || opt_full)
+       if (opt_pattern || opt_full || opt_longlong)
                flags |= PROC_FILLCOM;
        if (opt_ruid || opt_rgid)
                flags |= PROC_FILLSTATUS;
@@ -538,7 +538,7 @@ static struct el * select_procs (int *num)
                                match = match_strlist (tty, opt_term);
                        }
                }
-               if (task.cmdline && (opt_longlong || opt_full) && match && opt_pattern) {
+               if (task.cmdline && (opt_longlong || opt_full) ) {
                        int i = 0;
                        int bytes = sizeof (cmdline) - 1;