]>
Commit | Line | Data |
---|---|---|
1f2f436a A |
1 | --- fputs.c.bsdnew 2009-11-11 13:33:08.000000000 -0800 |
2 | +++ fputs.c 2009-11-11 13:33:08.000000000 -0800 | |
3 | @@ -44,6 +44,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f | |
9385eb3d A |
4 | #include "libc_private.h" |
5 | #include "local.h" | |
6 | ||
7 | +// 3340719: __puts_null__ is used if string is NULL. Defined in puts.c | |
8 | +__private_extern__ char const __puts_null__[]; | |
9 | + | |
10 | /* | |
11 | * Write the given string to the given file. | |
12 | */ | |
1f2f436a | 13 | @@ -56,6 +59,9 @@ fputs(s, fp) |
9385eb3d A |
14 | struct __suio uio; |
15 | struct __siov iov; | |
16 | ||
17 | + // 3340719: __puts_null__ is used if s is NULL | |
18 | + if(s == NULL) | |
19 | + s = __puts_null__; | |
20 | iov.iov_base = (void *)s; | |
21 | iov.iov_len = uio.uio_resid = strlen(s); | |
22 | uio.uio_iov = &iov; | |
1f2f436a | 23 | @@ -64,5 +70,9 @@ fputs(s, fp) |
224c7076 A |
24 | ORIENT(fp, -1); |
25 | retval = __sfvwrite(fp, &uio); | |
26 | FUNLOCKFILE(fp); | |
27 | +#if __DARWIN_UNIX03 | |
28 | + if (retval == 0) | |
29 | + return iov.iov_len; | |
30 | +#endif /* __DARWIN_UNIX03 */ | |
31 | return (retval); | |
32 | } |