summaryrefslogtreecommitdiff
path: root/usr.sbin/dvmrpd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/dvmrpd/parse.y')
-rw-r--r--usr.sbin/dvmrpd/parse.y29
1 files changed, 15 insertions, 14 deletions
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index 9e8941ddf35..226e96f7170 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.13 2007/11/12 23:59:41 mpf Exp $ */
+/* $OpenBSD: parse.y,v 1.14 2008/02/26 10:09:58 mpf Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -51,7 +51,7 @@ static struct file {
char *name;
int lineno;
int errors;
-} *file;
+} *file, *topfile;
struct file *pushfile(const char *, int);
int popfile(void);
int check_file_secrecy(int, const char *);
@@ -430,8 +430,9 @@ lgetc(int quotec)
if (quotec) {
if ((c = getc(file->stream)) == EOF) {
- yyerror("reached end of file while parsing quoted string");
- if (popfile() == EOF)
+ yyerror("reached end of file while parsing "
+ "quoted string");
+ if (file == topfile || popfile() == EOF)
return (EOF);
return (quotec);
}
@@ -449,7 +450,7 @@ lgetc(int quotec)
}
while (c == EOF) {
- if (popfile() == EOF)
+ if (file == topfile || popfile() == EOF)
return (EOF);
c = getc(file->stream);
}
@@ -690,16 +691,15 @@ popfile(void)
{
struct file *prev;
- if ((prev = TAILQ_PREV(file, files, entry)) != NULL) {
+ if ((prev = TAILQ_PREV(file, files, entry)) != NULL)
prev->errors += file->errors;
- TAILQ_REMOVE(&files, file, entry);
- fclose(file->stream);
- free(file->name);
- free(file);
- file = prev;
- return (0);
- }
- return (EOF);
+
+ TAILQ_REMOVE(&files, file, entry);
+ fclose(file->stream);
+ free(file->name);
+ free(file);
+ file = prev;
+ return (file ? 0 : EOF);
}
struct dvmrpd_conf *
@@ -713,6 +713,7 @@ parse_config(char *filename, int opts)
errx(1, "parse_config calloc");
return (NULL);
}
+ topfile = file;
defs = &globaldefs;
defs->probe_interval = DEFAULT_PROBE_INTERVAL;