From 6785ca65ab48f1a29914c1784a24009964ec4720 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 9 Feb 2017 16:49:56 +0100 Subject: ipcpd, lib: Report IPCP creation failure The IPCP will now respond with an ipcp_create_r message when it fails, informing the IRMd. Also adds some const qualifiers in the public headers and fixes some formatting in dev.c. --- src/irmd/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/irmd/main.c') diff --git a/src/irmd/main.c b/src/irmd/main.c index c029b4cf..74cb8359 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -303,10 +303,14 @@ static pid_t create_ipcp(char * name, return api->pid; } -static int create_ipcp_r(pid_t api) +static int create_ipcp_r(pid_t api, + int result) { struct list_head * pos = NULL; + if (result != 0) + return result; + pthread_rwlock_rdlock(&irmd->state_lock); pthread_rwlock_rdlock(&irmd->reg_lock); @@ -1821,7 +1825,7 @@ void * mainloop(void * o) break; case IRM_MSG_CODE__IPCP_CREATE_R: ret_msg.has_result = true; - ret_msg.result = create_ipcp_r(msg->api); + ret_msg.result = create_ipcp_r(msg->api, msg->result); break; case IRM_MSG_CODE__IRM_DESTROY_IPCP: ret_msg.has_result = true; -- cgit v1.2.3