X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fparser.c;h=3153a657c7528f729e3341972f02fae91783496f;hp=11728b779ce66f1af15900857e4d33168a1cc3a8;hb=a5db3ced87f5f24500f785b70af8b8630bc1c077;hpb=4fee70ab7c67e268eff0ba16b42a71d36c11e727 diff --git a/discover/parser.c b/discover/parser.c index 11728b7..3153a65 100644 --- a/discover/parser.c +++ b/discover/parser.c @@ -37,7 +37,7 @@ static int read_file(struct discover_context *ctx, if (len > max_file_size) goto err_close; - buf = talloc_array(ctx, char, len); + buf = talloc_array(ctx, char, len + 1); if (!buf) goto err_close; @@ -55,6 +55,8 @@ static int read_file(struct discover_context *ctx, } + buf[len] = '\0'; + close(fd); *bufp = buf; *lenp = len; @@ -114,6 +116,8 @@ static void iterate_parser_files(struct discover_context *ctx, rc = read_file(ctx, path, &buf, &len); if (!rc) { + pb_log("Running parser %s on file %s\n", + parser->name, *filename); parser->parse(ctx, buf, len); talloc_free(buf); }