summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tool_parsecfg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index e36b06c23..683e25ac1 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -46,7 +46,7 @@ static char *my_get_line(FILE *fp);
/* return 0 on everything-is-fine, and non-zero otherwise */
int parseconfig(const char *filename, struct GlobalConfig *global)
{
- FILE *file;
+ FILE *file = NULL;
char filebuffer[512];
bool usedarg = FALSE;
int rc = 0;
@@ -69,7 +69,6 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
*/
file = fopen(filebuffer, FOPEN_READTEXT);
if(file != NULL) {
- fclose(file);
filename = filebuffer;
}
else {
@@ -110,7 +109,9 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
#endif
}
- if(strcmp(filename, "-"))
+ if(file != NULL) /* WIN32: no need to fopen() again */
+ ;
+ else if(strcmp(filename, "-"))
file = fopen(filename, FOPEN_READTEXT);
else
file = stdin;