]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/puts.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / stdio / FreeBSD / puts.c.patch
1 --- /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/puts.c.orig 2004-03-10 01:15:38.000000000 -0800
2 +++ /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/puts.c 2004-10-24 17:08:31.000000000 -0700
3 @@ -48,6 +48,9 @@
4 #include "libc_private.h"
5 #include "local.h"
6
7 +// 3340719: __puts_null__ is used if string is NULL. Shared by fputs.c
8 +__private_extern__ char const __puts_null__[] = "(null)";
9 +
10 /*
11 * Write the given string to stdout, appending a newline.
12 */
13 @@ -56,12 +59,15 @@
14 char const *s;
15 {
16 int retval;
17 - size_t c = strlen(s);
18 + size_t c;
19 struct __suio uio;
20 struct __siov iov[2];
21
22 + // 3340719: __puts_null__ is used if s is NULL
23 + if(s == NULL)
24 + s = __puts_null__;
25 iov[0].iov_base = (void *)s;
26 - iov[0].iov_len = c;
27 + iov[0].iov_len = c = strlen(s);
28 iov[1].iov_base = "\n";
29 iov[1].iov_len = 1;
30 uio.uio_resid = c + 1;