]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/fputs.c.patch
Libc-594.1.4.tar.gz
[apple/libc.git] / stdio / FreeBSD / fputs.c.patch
1 Index: fputs.c
2 ===================================================================
3 RCS file: /cvs/root/Libc/stdio/FreeBSD/fputs.c,v
4 retrieving revision 1.2
5 diff -u -d -b -w -p -u -r1.2 fputs.c
6 --- fputs.c 2003/05/20 22:22:42 1.2
7 +++ fputs.c 2004/12/31 22:46:58
8 @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
9 #include "libc_private.h"
10 #include "local.h"
11
12 +// 3340719: __puts_null__ is used if string is NULL. Defined in puts.c
13 +__private_extern__ char const __puts_null__[];
14 +
15 /*
16 * Write the given string to the given file.
17 */
18 @@ -60,6 +63,9 @@ fputs(s, fp)
19 struct __suio uio;
20 struct __siov iov;
21
22 + // 3340719: __puts_null__ is used if s is NULL
23 + if(s == NULL)
24 + s = __puts_null__;
25 iov.iov_base = (void *)s;
26 iov.iov_len = uio.uio_resid = strlen(s);
27 uio.uio_iov = &iov;
28 @@ -68,5 +74,9 @@ fputs(s, fp)
29 ORIENT(fp, -1);
30 retval = __sfvwrite(fp, &uio);
31 FUNLOCKFILE(fp);
32 +#if __DARWIN_UNIX03
33 + if (retval == 0)
34 + return iov.iov_len;
35 +#endif /* __DARWIN_UNIX03 */
36 return (retval);
37 }