From: Mathieu Desnoyers Date: Sat, 19 Nov 2011 17:17:03 +0000 (-0500) Subject: Simply close socket when application registration is refused X-Git-Tag: v2.0-pre15~97 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88ff5b7f958a7bb60723d10ed97ceb79f9913167;p=lttng-tools.git Simply close socket when application registration is refused Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 0acf230e0..54dcbdff0 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1060,9 +1060,10 @@ static void *thread_manage_apps(void *data) /* Register applicaton to the session daemon */ ret = ust_app_register(&ust_cmd.reg_msg, ust_cmd.sock); - if (ret < 0) { - /* Only critical ENOMEM error can be returned here */ + if (ret == -ENOMEM) { goto error; + } else if (ret < 0) { + break; } /* diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index 6c9d40f42..ab65f2b15 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -846,6 +846,7 @@ int ust_app_register(struct ust_register_msg *msg, int sock) "%d-bit lttng-consumerd is available.\n", msg->name, msg->pid, msg->bits_per_long, CAA_BITS_PER_LONG); + close(sock); return -EINVAL; }