[sr-dev] git:master:c0125e04: evapi: handle return code for fcntl

Daniel-Constantin Mierla miconda at gmail.com
Sun Jul 9 10:22:09 CEST 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-09T10:21:20+02:00

evapi: handle return code for fcntl

---

Modified: src/modules/evapi/evapi_dispatch.c

---

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

---

diff --git a/src/modules/evapi/evapi_dispatch.c b/src/modules/evapi/evapi_dispatch.c
index 5429d6913b..aa07a8eb4b 100644
--- a/src/modules/evapi/evapi_dispatch.c
+++ b/src/modules/evapi/evapi_dispatch.c
@@ -591,6 +591,7 @@ int evapi_run_dispatcher(char *laddr, int lport)
 	struct ev_io io_server;
 	struct ev_io io_notify;
 	int yes_true = 1;
+	int fflags = 0;
 
 	LM_DBG("starting dispatcher processing\n");
 
@@ -619,7 +620,15 @@ int evapi_run_dispatcher(char *laddr, int lport)
 		return -1;
 	}
 	/* set non-blocking flag */
-	fcntl(evapi_srv_sock, F_SETFL, fcntl(evapi_srv_sock, F_GETFL) | O_NONBLOCK);
+	fflags = fcntl(evapi_srv_sock, F_GETFL);
+	if(fflags<0) {
+		LM_ERR("failed to get the srv socket flags\n");
+		return -1;
+	}
+	if (fcntl(evapi_srv_sock, F_SETFL, fflags | O_NONBLOCK)<0) {
+		LM_ERR("failed to set srv socket flags\n");
+		return -1;
+	}
 
 	bzero(&evapi_srv_addr, sizeof(evapi_srv_addr));
 	evapi_srv_addr.sin_family = h->h_addrtype;




More information about the sr-dev mailing list