liblttng-ust-comm: move `_unlock_fd_tracker()` after `close()` on error paths
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 12 Dec 2019 14:32:00 +0000 (09:32 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 13 Feb 2020 17:13:35 +0000 (12:13 -0500)
commit20d1999d42392063fd530d1f6c00b93c25d178d6
tree8bc3d6a614ca6129269c463f3bd0b2dbdcb0cfda
parent98a97f249e4708f2a14c648962fc2b5423a55d77
liblttng-ust-comm: move `_unlock_fd_tracker()` after `close()` on error paths

Right now, receiving an error from `lttng_ust_add_fd_to_tracker()` means that
the fd was _not_ added to the fd set. So the `lttng_ust_safe_close_fd()`
(overriding `close()`) call will indeed close the fd as expected. So, it
doesn't matter if the `close()` is before or after the `_unlock_`.

Even considering that, I believe that it's clearer and more common to
have all related operations within the `_lock_` and  `_unlock_`
functions. Also, `lttng_ust_add_fd_to_tracker()` might be modified in
the future and fail for some other reason.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id29a6ab004cfd5ca601615e1a70c74cf754b12e2
liblttng-ust-comm/lttng-ust-comm.c
This page took 0.02502 seconds and 4 git commands to generate.