Index: contrib/netbsd-tests/usr.bin/grep/t_grep.sh =================================================================== --- contrib/netbsd-tests/usr.bin/grep/t_grep.sh +++ contrib/netbsd-tests/usr.bin/grep/t_grep.sh @@ -369,7 +369,8 @@ } egrep_empty_invalid_body() { - atf_check -s exit:1 egrep '{' /dev/null + atf_check -e ignore -s not-exit:0 egrep '{' /dev/null + atf_check -e empty -s not-exit:0 egrep -q '{' /dev/null } atf_test_case zerolen Index: usr.bin/grep/grep.c =================================================================== --- usr.bin/grep/grep.c +++ usr.bin/grep/grep.c @@ -739,7 +739,7 @@ continue; #endif c = regcomp(&r_pattern[i], pattern[i].pat, cflags); - if (c != 0) { + if (c != 0 && !qflag) { regerror(c, &r_pattern[i], re_error, RE_ERROR_BUF); errx(2, "%s", re_error);