svn commit: r225484 - user/gabor/grep/trunk
Gabor Kovesdan
gabor at FreeBSD.org
Sun Sep 11 19:31:42 UTC 2011
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)
More information about the svn-src-user
mailing list