From c60cb454300598f85271c5be926b07100bf7847c Mon Sep 17 00:00:00 2001 From: David Date: Tue, 7 Jan 2014 20:22:57 +0800 Subject: [PATCH] Cannot read config file properly. --- src/jconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jconf.c b/src/jconf.c index 2a678458..f035db9d 100644 --- a/src/jconf.c +++ b/src/jconf.c @@ -76,8 +76,8 @@ jconf_t *read_jconf(const char* file) buf = malloc(pos + 1); if (buf == NULL) FATAL("No enough memory."); - int err = fread(buf, pos, 1, f); - if (err) FATAL("Failed to read the config file."); + int nread = fread(buf, pos, 1, f); + if (!nread) FATAL("Failed to read the config file."); fclose(f); buf[pos] = '\0'; // end of string