Module: kamailio Branch: master Commit: e5f6e83557a73c0597ddac8f2f23d99631339657 URL: https://github.com/kamailio/kamailio/commit/e5f6e83557a73c0597ddac8f2f23d99631339657
Author: Daniel-Constantin Mierla <[email protected]> Committer: Daniel-Constantin Mierla <[email protected]> Date: 2018-10-03T12:29:18+02:00 core: async task - handle return code for fcntl(...) --- Modified: src/core/async_task.c --- Diff: https://github.com/kamailio/kamailio/commit/e5f6e83557a73c0597ddac8f2f23d99631339657.diff Patch: https://github.com/kamailio/kamailio/commit/e5f6e83557a73c0597ddac8f2f23d99631339657.patch --- diff --git a/src/core/async_task.c b/src/core/async_task.c index a6b9d4ef8d..870241b0d3 100644 --- a/src/core/async_task.c +++ b/src/core/async_task.c @@ -75,13 +75,23 @@ int async_task_workers_active(void) */ int async_task_init_sockets(void) { + int val; + if (socketpair(PF_UNIX, SOCK_DGRAM, 0, _async_task_sockets) < 0) { LM_ERR("opening tasks dgram socket pair\n"); return -1; } - if (_async_nonblock) - fcntl(_async_task_sockets[1], F_SETFL, fcntl(_async_task_sockets[1], F_GETFL, 0) | O_NONBLOCK); + if (_async_nonblock) { + val = fcntl(_async_task_sockets[1], F_GETFL, 0); + if(val<0) { + LM_WARN("failed to get socket flags\n"); + } else { + if(fcntl(_async_task_sockets[1], F_SETFL, val | O_NONBLOCK)<0) { + LM_WARN("failed to set socket nonblock flag\n"); + } + } + } LM_DBG("inter-process event notification sockets initialized\n"); return 0; _______________________________________________ Kamailio (SER) - Development Mailing List [email protected] https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
