[OpenWrt-Devel] [project/ucwmp.git][PATCH V2] session: check for uclient_connect return value
Rafał Miłecki
zajec5 at gmail.com
Mon Jul 21 12:05:15 EDT 2014
uclient_connect may return an error and calling uclient_write will cause
a crash
Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
V2: Use "exit", otherwise cwmp-session will hang... no idea why :(
---
session/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/session/main.c b/session/main.c
index 147c949..e35cd5b 100644
--- a/session/main.c
+++ b/session/main.c
@@ -139,9 +139,16 @@ static void cwmp_dump_message(const char *msg, const char *data)
static void __cwmp_send_request(struct uloop_timeout *t)
{
int len = 0;
+ int err;
+
cwmp_dump_message("Send CPE data", cur_request);
- uclient_connect(uc);
+ err = uclient_connect(uc);
+ if (err) {
+ fprintf(stderr, "Failed to connect to the server: %d\n", err);
+ exit(255);
+ }
+
uclient_http_set_request_type(uc, "POST");
cwmp_add_cookies(uc);
--
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list