Commit 4348a750 authored by Alejandro Mery's avatar Alejandro Mery
Browse files

fex2bin: break parsing loop when it's not ok

parent 7020ebff
......@@ -53,7 +53,7 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
struct script_section *last_section = NULL;
/* TODO: deal with longer lines correctly (specially in comments) */
for(size_t line = 1; fgets(buffer, sizeof(buffer), in); line++) {
for(size_t line = 1; ok && fgets(buffer, sizeof(buffer), in); line++) {
char *s = skip_blank(buffer); /* beginning */
char *pe = s; /* \0... to be found */
......@@ -91,6 +91,7 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
errf("E: %s:%zu: incomplete section declaration.\n",
filename, line);
}
ok = 0;
} else {
/* key = value */
const char *key = s;
......@@ -177,7 +178,7 @@ static int parse_fex(FILE *in, const char *filename, struct script *script)
errf("E: %s:%zu: invalid character at %zu.\n",
filename, line, p-buffer+1);
}
ok = 0;
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment