Skip to content

Commit 518e874

Browse files
committed
Merge branch 'es/grep-require-name-when-needed' into maint
More parameter validation. * es/grep-require-name-when-needed: grep: fail if call could output and name is null
2 parents 90891c6 + de99eb0 commit 518e874

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

grep.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,10 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
17801780
enum grep_context ctx = GREP_CONTEXT_HEAD;
17811781
xdemitconf_t xecfg;
17821782

1783+
if (!opt->status_only && gs->name == NULL)
1784+
BUG("grep call which could print a name requires "
1785+
"grep_source.name be non-NULL");
1786+
17831787
if (!opt->output)
17841788
opt->output = std_output;
17851789

0 commit comments

Comments
 (0)