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.12.0-rc1~745 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=45798a31cc31b86a669221676ab490c035c8dfdd;hp=c827506eb07ba1986ce3d673ed8d08f6543d9460;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); }