From e65fc0a529f3520cf929901ff927c908d052298f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=B6llendorf?= Date: Tue, 14 May 2024 18:41:39 +0200 Subject: [PATCH] =?UTF-8?q?Prevent=20warning:=20ignoring=20return=20value?= =?UTF-8?q?=20of=20=E2=80=98fgets=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ..., declared with attribute warn_unused_result [-Wunused-result] --- test/test_iniparser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/test_iniparser.c b/test/test_iniparser.c index 134b0c2..a638510 100644 --- a/test/test_iniparser.c +++ b/test/test_iniparser.c @@ -858,6 +858,7 @@ void Test_iniparser_dump(CuTest *tc) dictionary *dic; FILE *fp = NULL; char buff[255]; + char *ret; /*loading old.ini*/ dic = iniparser_load(OLD_INI_PATH); @@ -887,20 +888,23 @@ void Test_iniparser_dump(CuTest *tc) printf("error: test.txt is not exist"); exit(-1); } - fgets(buff,100,fp); + ret = fgets(buff,100,fp); + (void)ret; /*remove '\n'*/ if(buff[strlen(buff)-1] == '\n') { buff[strlen(buff)-1] = '\0'; } CuAssertStrEquals(tc,"[section]=UNDEF",buff); - fgets(buff,100,fp); + ret = fgets(buff,100,fp); + (void)ret; if(buff[strlen(buff)-1] == '\n') { buff[strlen(buff)-1] = '\0'; } CuAssertStrEquals(tc,"[section:key_01]=[hello world]",buff); - fgets(buff,100,fp); + ret = fgets(buff,100,fp); + (void)ret; if(buff[strlen(buff)-1] == '\n') { buff[strlen(buff)-1] = '\0';