On Sun, 2012-02-12 at 19:34 +0200, Eli Zaretskii wrote:
> > Date: Sun, 12 Feb 2012 18:11:49 +0100
> > From: Sebastian Pipping <sebast...@pipping.org>
> > CC: psm...@gnu.org, bug-make@gnu.org
> > 
> > Since we would run into buffer overflows with sprintf/vsprintf, we
> > rely on snprintf/vsnprintf for that task.  Quoting from my "man 3
> > printf" output:
> > 
> >   snprintf(), vsnprintf():
> >     _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE \
> >       || _POSIX_C_SOURCE >= 200112L;
> >     or cc -std=c99
> > 
> > That's my understanding of the situation.
> 
> If all you need is vsnprintf, I think you can rely on it being
> present, and if it isn't, disable argument reordering on that
> platform.  Or we could import one from libiberty or from gnulib, I
> guess.  Paul?

I don't see any good way to support systems without vsnprintf(), if we
decide to depend on it, except for writing a lot of yucky ifdef'd code
scattered throughout the codebase.

If we have vsnprintf() we can abstract away the construction of the
string into a general function.  If we don't, we have to do it down at
the very lowest level and pass va_lists around, which means the function
signature of the lowest-level functions will have to be different, etc.

Pulling in an implementation from gnulib, just in case, might be the way
to go.


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to