Re: [PATCH] Don't push /dev/null as an argument of grep when -c is required.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pierre Habouzit <madcoder@xxxxxxxxxx> writes:

> Signed-off-by: Pierre Habouzit <madcoder@xxxxxxxxxx>
> ---
>  builtin-grep.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-grep.c b/builtin-grep.c
> index e13cb31..b93fa00 100644
> --- a/builtin-grep.c
> +++ b/builtin-grep.c
> @@ -261,7 +261,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
>  	 *
>  	 * GNU grep has "-H", but this is portable.
>  	 */
> -	if (!opt->name_only && !opt->unmatch_name_only)
> +	if (!opt->name_only && !opt->unmatch_name_only && !opt->count)
>  		push_arg("/dev/null");
>  
>  	hit = 0;

I am afraid this does not work either.

The /dev/null here is to avoid sending a singleton filename to
the external grep when we need to split the argument list, as
output from "grep foo A B" and concatenation of output from
"grep foo A" and "grep foo B" are different.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux