<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thanks Cristian,<br>
<br>
You're right, it's the POSIX function that I was meaning to
reference.<br>
<br>
I've opted to intercept the null pointer issue in my wrapper
function, for now:<br>
<br>
</p>
<pre>@@ -116,6 +116,17 @@ int getaddrinfo(const char *restrict libc_node,
if (name_override && name_override[0] != '\0') {
libc_node = name_override;
}
+ if (libc_node == NULL) {
+ // replace with empty address str, as null ptr is not handled by ares_getaddrinfo()
+ if (hints.ai_family == AF_INET) {
+ libc_node = "0.0.0.0";
+ } else {
+ libc_node = "::";
+ }
+ if (getenv("DEBUG")) {
+ fprintf(stderr, __FILE__ ":%d Replaced the null libc_node arg with '%s'.\n", __LINE__, libc_node);
+ }
+ }
const char* local_dev_name = getenv("LOCAL_DEV");
if (local_dev_name) {
// requires root privileges, failure to apply is silently ignored
</pre>
<p>Which functions as desired. And I plan to propose a null-handling
patch for ares_getaddrinfo() soon.<br>
<br>
Best,<br>
Carson<br>
</p>
<div class="moz-cite-prefix">On 3/14/24 11:35 AM, Cristian Rodríguez
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAPBLoAcV875F-ZaVFZtaogn58rz-QcxnMV8qsprWo6OiAxpWeQ@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">On Thu, Mar 14, 2024 at 3:37 AM Carson Vandegriffe via c-ares
<a class="moz-txt-link-rfc2396E" href="mailto:c-ares@lists.haxx.se"><c-ares@lists.haxx.se></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
Hi all,
I've been working on an effort to override some (libc) getaddrinfo()
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
It is POSIX that you have to quote.. not the libc manual..
"If nodename is not null, the requested service location is named by
nodename; otherwise, the requested service location is local to the
caller."
It is a bug whatever interpretation is made.. fill a bug report.
</pre>
</blockquote>
</body>
</html>