Date: Sun, 11 Sep 2011 19:31:41 +0000 (UTC) From: Gabor Kovesdan <gabor@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225484 - user/gabor/grep/trunk Message-ID: <201109111931.p8BJVfcc092495@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gabor Date: Sun Sep 11 19:31:41 2011 New Revision: 225484 URL: http://svn.freebsd.org/changeset/base/225484 Log: - Fix an ugly file handling bug Modified: user/gabor/grep/trunk/grep.c Modified: user/gabor/grep/trunk/grep.c ============================================================================== --- user/gabor/grep/trunk/grep.c Sun Sep 11 18:00:46 2011 (r225483) +++ user/gabor/grep/trunk/grep.c Sun Sep 11 19:31:41 2011 (r225484) @@ -305,12 +305,11 @@ read_patterns(const char *fn) FILE *f; char *line; size_t len; - int fd; if ((f = fopen(fn, "r")) == NULL) err(2, "%s", fn); if ((fstat(fileno(f), &st) == -1) || (S_ISDIR(st.st_mode))) { - close(fd); + fclose(f); return; } while ((line = fgetln(f, &len)) != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109111931.p8BJVfcc092495>