[Samba] snprintf, vsnprintf
William Jojo
jojowil at hvcc.edu
Thu Jun 26 11:42:39 GMT 2003
got it now...my built in diff does not support -u.
this is against 2.2.8a on AIX 5.2. I've tested it on 5.2 with IBM C 6.0
and it compiled fine after this patch.
the first change resolves the uneeded #else clause that causes the compile
to occur, but the link of smbd to fail since the linker is looking for
.SAFE_FREE and .VA_COPY.
the second change converts the test to what i believe is more accurate if
you are to redefine snprintf for a system. HAVE_C99_SNPRINTF can never be
defined and I don't think the intention was to use HAVE_C99_VSNPRINTF.
--- snprintf.orig 2003-06-25 19:20:54.000000000 -0400
+++ snprintf.c 2003-06-25 19:23:31.000000000 -0400
@@ -84,9 +84,7 @@
#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) &&
defined(HAVE_C99_VSNPR
INTF)
/* only include stdio.h if we are not re-defining snprintf or vsnprintf
*/
#include <stdio.h>
- /* make the compiler happy with an empty file */
- void dummy_snprintf(void) {}
-#else
+#endif
#ifdef HAVE_LONG_DOUBLE
#define LDOUBLE long double
@@ -111,7 +109,6 @@
#else
#define VA_COPY(dest, src) (dest) = (src)
#endif
-#endif
static size_t dopr(char *buffer, size_t maxlen, const char *format,
va_list args_in);
@@ -787,7 +784,7 @@
* these should really be smb_snprintf to avoid conflicts with buggy
* linkers? -- mbp
*/
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_SNPRINTF)
+#if !defined(HAVE_SNPRINTF) || !defined(HAVE_SNPRINTF_DECL)
int snprintf(char *str,size_t count,const char *fmt,...)
{
size_t ret;
Thanks!
Bill
On 26 Jun 2003, Andrew Bartlett wrote:
> On Thu, 2003-06-26 at 10:23, William Jojo wrote:
> >
> >
> >
> >
> > On Wed, 25 Jun 2003, William Jojo wrote:
> >
> > >
> > > anyway the bug i'm tracking is a failure to expand the macros SAFE_FREE
> > > and VA_COPY. is compiles fine in AIX 5.1. as soon as i figure that one
> > > out, i'll forward it.
> > >
> >
> >
> > found it. you are penalized in snprintf.c if you have all three of
> > HAVE_SNPRINTF, HAVE_VSNPRINTF and HAVE_C99_VSNPRINTF by what i believe is
> > an unnecessary else clause. It will include stdio.h, but will not define
> > SAFE_FREE and VA_COPY.
> >
> > AIX 5.1 does not have vsnprintf so it compiles there.
> >
> > I think this is what the change should be - pardon my misuse if diff, i
> > would like to know the correct format for submitting patches, but could
> > not find it during my short search of the site.
>
> diff -u would make this legible.
>
> Also, what version was this against?
>
> Andrew Bartlett
>
> --
> Andrew Bartlett abartlet at pcug.org.au
> Manager, Authentication Subsystems, Samba Team abartlet at samba.org
> Student Network Administrator, Hawker College abartlet at hawkerc.net
> http://samba.org http://build.samba.org http://hawkerc.net
>
More information about the samba
mailing list