Loading...
stdio/FreeBSD/fputs.c.patch /dev/null Libc-498
--- /dev/null
+++ Libc/Libc-498/stdio/FreeBSD/fputs.c.patch
@@ -0,0 +1,37 @@
+Index: fputs.c
+===================================================================
+RCS file: /cvs/root/Libc/stdio/FreeBSD/fputs.c,v
+retrieving revision 1.2
+diff -u -d -b -w -p -u -r1.2 fputs.c
+--- fputs.c	2003/05/20 22:22:42	1.2
++++ fputs.c	2004/12/31 22:46:58
+@@ -48,6 +48,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/f
+ #include "libc_private.h"
+ #include "local.h"
+ 
++// 3340719: __puts_null__ is used if string is NULL.  Defined in puts.c
++__private_extern__ char const __puts_null__[];
++
+ /*
+  * Write the given string to the given file.
+  */
+@@ -60,6 +63,9 @@ fputs(s, fp)
+ 	struct __suio uio;
+ 	struct __siov iov;
+ 
++	// 3340719: __puts_null__ is used if s is NULL
++	if(s == NULL)
++		s = __puts_null__;
+ 	iov.iov_base = (void *)s;
+ 	iov.iov_len = uio.uio_resid = strlen(s);
+ 	uio.uio_iov = &iov;
+@@ -68,5 +74,9 @@ fputs(s, fp)
+ 	ORIENT(fp, -1);
+ 	retval = __sfvwrite(fp, &uio);
+ 	FUNLOCKFILE(fp);
++#if __DARWIN_UNIX03
++	if (retval == 0)
++		return iov.iov_len;
++#endif /* __DARWIN_UNIX03 */
+ 	return (retval);
+ }