From: Jérémie Galarneau Date: Fri, 16 Nov 2018 18:55:57 +0000 (-0500) Subject: Docs: document why a negative socket may be passed X-Git-Tag: v2.11.0-rc2~159 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c1cd9f61d342680f41df3b2812a0ecab447d3a21;p=lttng-tools.git Docs: document why a negative socket may be passed 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 --- 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); }