Docs: document why a negative socket may be passed
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Nov 2018 18:55:57 +0000 (13:55 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Nov 2018 20:48:07 +0000 (15:48 -0500)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-app.c

index 5b37a8e7444a93da9600eaa9b96354309117a923..23f29c13ca414a0a02903952879701b73dda397b 100644 (file)
@@ -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);
                }
                        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);
                }
                if (sock >= 0) {
                        save_per_pid_lost_discarded_counters(ua_chan);
                }
This page took 0.032026 seconds and 4 git commands to generate.