X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=conf-parser.c;h=aebf61aaf5067a77086be7594c0d0b14506b95dc;hp=4075465b2496719bfec6275eddc22d4c68f55e99;hb=63ad1ab4f333351914abf0c3e78d4b3fa2e1cb66;hpb=a7334b0952ab66c17ee787e36e6d2c5ceb387de6 diff --git a/conf-parser.c b/conf-parser.c index 4075465b2..aebf61aaf 100644 --- a/conf-parser.c +++ b/conf-parser.c @@ -135,6 +135,7 @@ int config_parse(const char *filename, FILE *f, const char* const * sections, co unsigned line = 0; char *section = NULL; int r; + bool ours = false; assert(filename); assert(t); @@ -145,6 +146,8 @@ int config_parse(const char *filename, FILE *f, const char* const * sections, co log_error("Failed to open configuration file '%s': %s", filename, strerror(-r)); goto finish; } + + ours = true; } while (!feof(f)) { @@ -168,7 +171,7 @@ int config_parse(const char *filename, FILE *f, const char* const * sections, co finish: free(section); - if (f) + if (f && ours) fclose(f); return r;