]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add UV_RUNTIME_CHECK() macro to print uv_strerror()
authorOndřej Surý <ondrej@isc.org>
Tue, 15 Feb 2022 13:44:29 +0000 (14:44 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 16 Feb 2022 10:16:57 +0000 (11:16 +0100)
When libuv functions fail, they return correct return value that could
be useful for more detailed debugging.  Currently, we usually just check
whether the return value is 0 and invoke assertion error if it doesn't
throwing away the details why the call has failed.  Unfortunately, this
often happen on more exotic platforms.

Add a UV_RUNTIME_CHECK() macro that can be used to print more detailed
error message (via uv_strerror() before ending the execution of the
program abruptly with the assertion.

lib/isc/netmgr/netmgr-int.h

index b8a49feef20fee7bef36a452ab38d8b83cc79791..2ce53402b2de88f992e571753da227cd4998ae93 100644 (file)
@@ -2078,3 +2078,9 @@ void
 isc__nm_accept_connection_log(isc_result_t result, bool can_log_quota);
 
 #define STREAM_CLIENTS_PER_CONN 23
+
+#define UV_RUNTIME_CHECK(func, ret)                                           \
+       if (ret != 0) {                                                       \
+               isc_error_fatal(__FILE__, __LINE__, "%s failed: %s\n", #func, \
+                               uv_strerror(ret));                            \
+       }