From 45798a31cc31b86a669221676ab490c035c8dfdd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 16 Nov 2018 13:55:57 -0500 Subject: [PATCH] Docs: document why a negative socket may be passed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The fix in 4821263c4 checks for a negative socket. While the commit message explains the reason for the check, it is not obvious why this check is needed when looking at the code itself. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/ust-app.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 5b37a8e74..23f29c13c 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -489,6 +489,11 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan, ust_registry_channel_del_free(registry, ua_chan->key, sock >= 0); } + /* + * A negative socket can be used by the caller when + * cleaning-up a ua_chan in an error path. Skip the + * accounting in this case. + */ if (sock >= 0) { save_per_pid_lost_discarded_counters(ua_chan); } -- 2.34.1