8.2.1: wrong master address in slave zone header comment
Andrew Brown
atatat at atatdot.net
Thu Aug 12 17:09:04 UTC 1999
>> ; from 129.143.2.4:53 (local 129.143.2.4) using AXFR at Wed Aug 11 09:59:39 1999
>>
>> Don't ask me why, but inet_ntoa(local.sin_addr) in fprintf() messes up
>> the master's address (Solaris-2.6, gcc).
>
>This is because of inet_ntoa function uses a static buffer that gets overwritten
>on every call. So don't use more than one inet_ntoa() in a single printf() or
>similar statement.
>
>I've been digging this up a while ago, but I was wondering, too.
i usually do this instead. it doesn't speak much for threading (since
it goes from one static object to two, but it will let you use
inet_ntoa() more than once in a printf().
*** inet_ntoa.c-orig Fri May 14 14:16:55 1999
--- inet_ntoa.c Thu Aug 12 12:13:32 1999
***************
*** 54,62 ****
*/
/*const*/ char *
inet_ntoa(struct in_addr in) {
! static char ret[18];
! strcpy(ret, "[inet_ntoa error]");
! (void) inet_ntop(AF_INET, &in, ret, sizeof ret);
! return (ret);
}
--- 54,64 ----
*/
/*const*/ char *
inet_ntoa(struct in_addr in) {
! static int retnum = -1;
! static char ret[10][18];
! retnum = (retnum + 1) % 10;
! strcpy(ret[retnum], "[inet_ntoa error]");
! (void) inet_ntop(AF_INET, &in, ret[retnum], sizeof ret[retnum]);
! return (ret[retnum]);
}
--
|-----< "CODE WARRIOR" >-----|
codewarrior at daemon.org * "ah! i see you have the internet
twofsonet at graffiti.com (Andrew Brown) that goes *ping*!"
andrew at crossbar.com * "information is power -- share the wealth."
More information about the bind-workers
mailing list