Ultrix patches for bind 8.2.2-P3
Mark_Andrews at iengines.com
Mark_Andrews at iengines.com
Tue Nov 16 06:06:06 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.
If that ends up being the only way.
#include <stdarg.h>
#include <stdio.h>
char *
my_sprintf(char *s, const char *format, ...) {
va_list ap;
va_start(ap, format);
vsprintf(s, format, ap);
va_end(va_list ap);
return(s);
}
--
Mark Andrews, Internet Engines Inc. / Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: Mark_Andrews at iengines.com
More information about the bind-workers
mailing list