summaryrefslogtreecommitdiff
path: root/usr.bin/error
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2016-05-30 16:26:34 +0000
committerdholland <dholland@NetBSD.org>2016-05-30 16:26:34 +0000
commitb4271ed05f5bc44ca18a1daa504110c8f801d7af (patch)
tree83547cc7b6abd4b0b49d38abaabeeef5cb6d567c /usr.bin/error
parent58ff5b8dddcd34d1abce4716ec77d60830b7852b (diff)
Use rewind() instead of freopen()'ing the same file for no reason. Also,
close the file when done instead of dropping it on the floor. Obsoletes PR 50579.
Diffstat (limited to 'usr.bin/error')
-rw-r--r--usr.bin/error/filter.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/usr.bin/error/filter.c b/usr.bin/error/filter.c
index 3adceef004f..e1065f93436 100644
--- a/usr.bin/error/filter.c
+++ b/usr.bin/error/filter.c
@@ -1,4 +1,4 @@
-/* $NetBSD: filter.c,v 1.16 2015/08/09 09:49:25 shm Exp $ */
+/* $NetBSD: filter.c,v 1.17 2016/05/30 16:26:34 dholland Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)filter.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: filter.c,v 1.16 2015/08/09 09:49:25 shm Exp $");
+__RCSID("$NetBSD: filter.c,v 1.17 2016/05/30 16:26:34 dholland Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -108,20 +108,14 @@ getignored(const char *auxname)
fgets(inbuffer, sizeof(inbuffer)-1, fyle) != NULL; nignored++)
continue;
names_ignored = Calloc(nignored+1, sizeof (char *));
- if (freopen(filename, "r", fyle) == NULL) {
-#ifdef FULLDEBUG
- fprintf(stderr, "%s: Failure to open \"%s\" for second read.\n",
- processname, filename);
-#endif
- nignored = 0;
- return;
- }
+ rewind(fyle);
for (i=0; i < nignored &&
(fgets (inbuffer, sizeof(inbuffer)-1, fyle) != NULL); i++) {
names_ignored[i] = strdup(inbuffer);
(void)substitute(names_ignored[i], '\n', '\0');
}
qsort(names_ignored, nignored, sizeof *names_ignored, lexsort);
+ fclose(fyle);
#ifdef FULLDEBUG
printf("Names to ignore follow.\n");
for (i=0; i < nignored; i++) {