> On Wed, Feb 11, 2015 at 05:18:51PM -0500, Thomas Schulz wrote:
> > I went ahead and hand compiled it. It dies with a Segmentation Fault.
> > The problem line is:
> >
> > if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
> >
> > If I comment that one out then it runs OK and prints 1.
> >
> > So the Solaris snprintf is most lilely not good enough.
>
> Unfortunately we have a lot of places in the DEBUG code where NULL could
> happen and we hope for snprintf to print "<null>". The
standard says
> that "The argument shall be a pointer to an array of char.",
which NULL
> probably does not fulfill. The right thing would be to eliminate this
> use of snprintf, but I'm not sure if we can catch all of them.
>
> You might want to try running without this line, so the system snprintf
> is used. But you might face some crashes in particular with higher debug
> levels. With debug level 0 or one, it should not happen, but it might
> when trying to diagnose problems. We're happy to fix those NULLs when
> you find and report them :-)
>
> Volker
There is nothing wrong with using the replacement snprintf now that it is
fixed. I was just wondering why the Solaris version was not being used, and
now I know. I went and checked on Linux and did find that it printed
"(null)". I assume that I do not need to file a bug on this.
Now on to the next problem which will be a different subject and shows
up on both Linux and Solaris.
Tom Schulz
Applied Dynamics Intl.
schulz at adi.com