diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:36:41 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-04-06 02:36:41 +0200 |
commit | 63ad1ab4f333351914abf0c3e78d4b3fa2e1cb66 (patch) | |
tree | 380820d8f8edc8ca3a8053906d84f18eecbd1180 | |
parent | 58783cdaec345e9a34c2ed2218fe4670d1d0dce5 (diff) |
conf-parser: don't close FILE* object if we didn't open it
-rw-r--r-- | conf-parser.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/conf-parser.c b/conf-parser.c index 4075465b24..aebf61aaf5 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; |