CLEANUP: dns: Use DISGUISE() on a never-failing ring_attach() call

When a DNS session is created, the call to ring_attach() never fails. The
ring is freshly initialized and there is other watcher on it. Thus, the call
always succeeds.

Instead of catching an error that must never happen, we use the DISGUISE()
macro to make static analyzers happy.
This commit is contained in:
Christopher Faulet 2021-03-04 16:53:27 +01:00
parent 6f69110191
commit 1a1b674c2c

View File

@ -1028,13 +1028,8 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss)
goto error;
ring_init(&ds->ring, ds->tx_ring_area, DNS_TCP_MSG_RING_MAX_SIZE);
if (!ring_attach(&ds->ring)) {
/* Should never happen
* since we are the first attached
* here
*/
goto error;
}
/* never fail because it is the first watcher attached to the ring */
DISGUISE(ring_attach(&ds->ring));
if ((ds->task_exp = task_new(tid_bit)) == NULL)
goto error;