]> git.ipfire.org Git - thirdparty/bind9.git/commit
Add an ERRNO_CHECK() preprocessor macro
authorMichał Kępień <michal@isc.org>
Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)
committerMichał Kępień <michal@isc.org>
Wed, 13 Jul 2022 11:19:32 +0000 (13:19 +0200)
commit365b47caee41f525c858a92796674f154dfd9131
tree09f63525ae4fb0d060180636101f90579be2a5ce
parent9968a6292dd60f538319e7cc69f2121a53a36fdb
Add an ERRNO_CHECK() preprocessor macro

In a number of situations in pthreads-related code, a common sequence of
steps is taken: if the value returned by a library function is not 0,
pass errno to strerror_r(), log the string returned by the latter, and
immediately abort execution.  Add an ERRNO_CHECK() preprocessor macro
which takes those exact steps and use it wherever (conveniently)
possible.

Notes:

 1. The "log the return value of strerror_r() and abort" pattern is used
    in a number of other places that this commit does not touch; only
    "!= 0" checks followed by isc_error_fatal() calls with
    non-customized error messages are replaced here.

 2. This change temporarily breaks file name & line number reporting for
    isc__mutex_init() errors, to prevent breaking the build.  This issue
    will be rectified in a subsequent change.
lib/isc/include/isc/condition.h
lib/isc/include/isc/mutex.h
lib/isc/include/isc/util.h
lib/isc/mutex.c
lib/isc/thread.c