]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/puts.c.patch
449ecec66cba1c20b4a22fb7e8b74b3471558854
[apple/libc.git] / stdio / FreeBSD / puts.c.patch
1 --- puts.c.orig Tue May 20 15:22:43 2003
2 +++ puts.c Thu Jul 31 13:21:00 2003
3 @@ -47,6 +47,9 @@
4 #include "fvwrite.h"
5 #include "libc_private.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 @@ -55,12 +58,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;