Date: Fri, 2 Sep 2011 16:46:42 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225335 - user/gabor/grep/trunk Message-ID: <201109021646.p82GkgP4007453@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Fri Sep 2 16:46:42 2011 New Revision: 225335 URL: http://svn.freebsd.org/changeset/base/225335 Log: - Add proper error handling for grep -F Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Fri Sep 2 16:40:18 2011 (r225334) +++ user/gabor/grep/trunk/grep.c Fri Sep 2 16:46:42 2011 (r225335) @@ -687,9 +687,15 @@ main(int argc, char *argv[]) /* Check if cheating is allowed (always is for fgrep). */ if (grepbehave == GREP_FIXED) { - for (i = 0; i < patterns; ++i) - fixncomp(&fg_pattern[i], pattern[i].pat, + for (i = 0; i < patterns; ++i) { + c = fixncomp(&fg_pattern[i], pattern[i].pat, pattern[i].len, cflags); + if (c != 0) { + regerror(c, &r_pattern[i], re_error, + RE_ERROR_BUF); + errx(2, "%s", re_error); + } + } } else { for (i = 0; i < patterns; ++i) { if (fastncomp(&fg_pattern[i], pattern[i].pat,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109021646.p82GkgP4007453>