talloc_asprintf dumping the length?
David Collier-Brown
davec-b at rogers.com
Sun Aug 13 22:57:43 GMT 2006
cat >x.c <<!
#include <stdio.h>
main() {
printf("%s\n", NULL);
}
!
froggy> cc x.c
"x.c", line 2: warning: old-style declaration or incorrect type for: main
froggy> ./a.out
Segmentation Fault
froggy>
I'm not entirely sure that's safe (:-))
--dave
Andrew Bartlett wrote:
> On Fri, 2006-08-11 at 10:32 +0200, Volker Lendecke wrote:
>
>>On Fri, Aug 11, 2006 at 09:52:28AM +1000, Andrew Bartlett wrote:
>>
>>>I find the current talloc_asprintf() convention to be much easier and
>>>more natural to code, particularly when used in debug statements.
>>
>>If you directly use the result in a debug statement, how do
>>you check if the result is != NULL?
>
>
> I don't. In Samba4, we assume that printf("%s", NULL) prints "(null)",
> which isn't a particularly bad failure mode.
>
> Andrew Bartlett
>
--
David Collier-Brown, | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net | -- Mark Twain
(416) 223-5943
More information about the samba-technical
mailing list