From ce25a8b8b6fea17e6bf1f3b0410fa40cf28dc52d Mon Sep 17 00:00:00 2001 From: hany_li Date: Mon, 18 Jul 2022 10:56:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=20fix=E5=9B=A0=E9=87=8E=E6=8C=87=E9=92=88?= =?UTF-8?q?=E4=BA=A7=E7=94=9F=E7=9A=84=E6=AE=B5=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9B=202.fix=E6=96=87=E4=BB=B6=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E8=AF=BB=E5=AE=8C=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gear-lib/libconfig/json/json_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gear-lib/libconfig/json/json_config.c b/gear-lib/libconfig/json/json_config.c index 5a756b4..9c65236 100644 --- a/gear-lib/libconfig/json/json_config.c +++ b/gear-lib/libconfig/json/json_config.c @@ -33,7 +33,7 @@ static int read_file(const char *name, void **buf, size_t *len) char *tmp = NULL; size_t ret = 0; - fp = fopen(name, "r+"); + fp = fopen(name, "rb"); if (fp == NULL) { goto cleanup; } @@ -98,7 +98,7 @@ static int js_load(struct config *c, const char *name) { cJSON *json; size_t len; - void *buf; + void *buf = NULL; read_file(name, &buf, &len); if (!buf) { printf("read_file %s failed!\n", name); -- Gitee