Background
==========
When building with the NDEBUG definition the `assert()` statements are
removed.
Issue
=====
Currently, a few `assert()` statements in the code base contain
statements that have side effects and removing them changes the
behavior for the program.
Fix
===
Extract the statements with side effects out of the `assert()`
statements.
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I0b11c8e25c3380563332b4c0fad15f70b09a7335
if (reg_sock) {
uint16_t port;
- assert(lttcomm_sock_get_port(reg_sock, &port) == 0);
+ ret = lttcomm_sock_get_port(reg_sock, &port);
+ assert(ret == 0);
ret = write_agent_port(port);
if (ret) {
ret = pipe(unknown_fds);
assert(!ret);
- assert(close(unknown_fds[0]) == 0);
- assert(close(unknown_fds[1]) == 0);
+ ret = close(unknown_fds[0]);
+ assert(ret == 0);
+ ret = close(unknown_fds[1]);
+ assert(ret == 0);
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
NULL, 1, noop_open, &stdout_fd);