From 5844a33f0be1af942ee33feae38b9d46169fd61c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 4 Nov 2004 21:27:12 +0000 Subject: some commenting change alogrithm for checking for configuration files git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@273 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/conf-parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'polyp/conf-parser.c') diff --git a/polyp/conf-parser.c b/polyp/conf-parser.c index 20e8e723..3d922c20 100644 --- a/polyp/conf-parser.c +++ b/polyp/conf-parser.c @@ -89,13 +89,13 @@ static int parse_line(const char *filename, unsigned line, const struct pa_confi } -int pa_config_parse(const char *filename, const struct pa_config_item *t, void *userdata) { - FILE *f; +int pa_config_parse(const char *filename, FILE *f, const struct pa_config_item *t, void *userdata) { int r = -1; unsigned line = 0; + int do_close = !f; assert(filename && t); - if (!(f = fopen(filename, "r"))) { + if (!f && !(f = fopen(filename, "r"))) { if (errno == ENOENT) { r = 0; goto finish; @@ -123,7 +123,7 @@ int pa_config_parse(const char *filename, const struct pa_config_item *t, void * finish: - if (f) + if (do_close && f) fclose(f); return r; -- cgit