--- /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/puts.c.orig 2004-03-10 01:15:38.000000000 -0800 +++ /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/puts.c 2004-10-24 17:08:31.000000000 -0700 @@ -48,6 +48,9 @@ #include "libc_private.h" #include "local.h" +// 3340719: __puts_null__ is used if string is NULL. Shared by fputs.c +__private_extern__ char const __puts_null__[] = "(null)"; + /* * Write the given string to stdout, appending a newline. */ @@ -56,12 +59,15 @@ char const *s; { int retval; - size_t c = strlen(s); + size_t c; struct __suio uio; struct __siov iov[2]; + // 3340719: __puts_null__ is used if s is NULL + if(s == NULL) + s = __puts_null__; iov[0].iov_base = (void *)s; - iov[0].iov_len = c; + iov[0].iov_len = c = strlen(s); iov[1].iov_base = "\n"; iov[1].iov_len = 1; uio.uio_resid = c + 1;