[sr-dev] git:master:104be62b: corex: fix compiler warning #612

Victor Seva linuxmaniac at torreviejawireless.org
Thu May 12 18:28:24 CEST 2016


Module: kamailio
Branch: master
Commit: 104be62b493c5783ddeb17aef4753969a7b3679c
URL: https://github.com/kamailio/kamailio/commit/104be62b493c5783ddeb17aef4753969a7b3679c

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-05-12T17:22:53+02:00

corex: fix compiler warning #612

* show error message if error in read file

> CC (clang) [M corex.so]     corex_mod.o
> corex_mod.c:352:2: warning: ignoring return value of function declared with warn_unused_result attribute [-Wunused-result]
>         fread(content, fsize, 1, f);
>        ^~~~~ ~~~~~~~~~~~~~~~~~~~~
> 1 warning generated.

---

Modified: modules/corex/corex_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/104be62b493c5783ddeb17aef4753969a7b3679c.diff
Patch: https://github.com/kamailio/kamailio/commit/104be62b493c5783ddeb17aef4753969a7b3679c.patch

---

diff --git a/modules/corex/corex_mod.c b/modules/corex/corex_mod.c
index b8b047f..3c87f21 100644
--- a/modules/corex/corex_mod.c
+++ b/modules/corex/corex_mod.c
@@ -349,7 +349,12 @@ static int w_file_read(sip_msg_t *msg, char *fn, char *vn)
 		fclose(f);
 		return -1;
 	}
-	fread(content, fsize, 1, f);
+	if(fread(content, fsize, 1, f) != fsize) {
+		if(ferror(f)) {
+			LM_ERR("error reading from file: %.*s\n",
+				fname.len, fname.s);
+		}
+	}
 	fclose(f);
 	content[fsize] = 0;
 




More information about the sr-dev mailing list