[Asterisk-Dev] Resolver issues with ENUM on non-Linux systems
Thorsten Lockert
tholo at sigmasoft.com
Fri May 16 08:26:49 MST 2003
Many non-Linux systems have the plain resolver routines be re-
entrant, and do not declare special reentrant versions with a
state variable. The enclosed diff makes the new ENUM code work
on these systems.
Index: enum.c
===================================================================
RCS file: /usr/cvsroot/asterisk/enum.c,v
retrieving revision 1.3
diff -u -r1.3 enum.c
--- enum.c 1 May 2003 14:26:17 -0000 1.3
+++ enum.c 16 May 2003 15:31:16 -0000
@@ -275,7 +279,11 @@
struct enum_search *s = NULL;
int version = -1;
struct __res_state enumstate;
+#ifdef __Linux__
res_ninit(&enumstate);
+#else
+ res_init();
+#endif
if (chan && ast_autoservice_start(chan) < 0)
return -1;
@@ -303,7 +311,11 @@
ast_pthread_mutex_unlock(&enumlock);
if (!s)
break;
+#ifdef __Linux__
res = res_nsearch(&enumstate, tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#else
+ res = res_search(tmp, C_IN, T_NAPTR, answer, sizeof(answer));
+#endif
if (res > 0)
break;
}
@@ -321,7 +333,11 @@
}
if (chan)
ret |= ast_autoservice_stop(chan);
+#ifdef __Linux__
res_nclose(&enumstate);
+#else
+ res_close();
+#endif
return ret;
}
--
Thorsten Lockert | tholo at sigmasoft.com | Universe, n.:
2121 N. Lakeshore Dr. | tholo at openbsd.org | The problem.
Chapel Hill, NC 27514 | |
More information about the asterisk-dev
mailing list