Ultrix patches for bind 8.2.2-P3
Simon Burge
simonb at telstra.com.au
Wed Nov 10 21:17:10 UTC 1999
Mark_Andrews at iengines.com wrote:
> > Here's some patches against bind 8.2.2-P3 for Ultrix. I've tested on
> > Ultrix 4.4 and 4.5, used the Ultrix (MIPS) C compiler and gcc 2.7.2.2,
> > and linked against both the original libc and the "y2k ready" libc
> > which replaced the resolver with the bind 4.9.3 Beta 17 resolver.
> >
> > I've done some basic testing and haven't seen a problem yet. As soon as
> > I'm happy with hesiod interaction (which we still use for passwords),
> > I'll try it on our main nameserver (which gets a whopping 6 queries a
> > second over it's current 133 day uptime ;).
> >
> > There's three things I'm not entirely happy with in this patch:
> >
> > 1) Ultrix' sprintf() is prototyped to return "int", yet it really
> > truly is a "char *". Changing the SPRINTF() macro in the
> > SPRINTF_CHAR case to always cast the return of sprintf() to
> > "char *" doesn't seem quite right. Two ideas - have a third
> > case in the ifdef checks, or have a define called
> > SPRINTF_CHAR_CAST. Both seem almost as ugly as the current
> > solution.
> >
> Last time I looked at Ultrix the return type from sprintf
> depended upon the -YPOSIX flag being set or not. This both
> changed the way it was declared in the include files and which
> implementation of sprintf was linked into the application by
> adding libraries to be linked against as well as libc.
>
> Just casting is the wrong thing to do.
If you have -YPOSIX on the link line, you get "-lcP -lc" instead of just
"-lc". The problem with this is that anything that then links against
libbind.a needs to have -YPOSIX as well, otherwise the wrong sprintf()
will get picked up.
Here's the problem I was talking about where sprintf() is declared
wrongly (from <stdio.h>):
#ifdef __STDC__
/* function prototype */
extern int sprintf( char *__s, const char *__format, ... );
#else
#if defined(__SYSTEM_FIVE) || defined(__POSIX)
extern int sprintf();
#else
extern char *sprintf();
#endif /* __SYSTEM_FIVE || __POSIX */
#endif /* __STDC__ */
Using "-std1" defined __STDC__, but doesn't affect what libraries
are linked in! I think a better way to solve this would be to leave
SPRINTF_CHAR in "port_after.h", but also have "#define sprintf
my_sprintf" in there and put something in the Ultrix noop.c that DTRT.
Does this sound any better?
Simon.
More information about the bind-workers
mailing list