Loading...
stdio/FreeBSD/fvwrite.c Libc-391.1.21 Libc-320.1.3
--- Libc/Libc-391.1.21/stdio/FreeBSD/fvwrite.c
+++ Libc/Libc-320.1.3/stdio/FreeBSD/fvwrite.c
@@ -38,8 +38,9 @@
 static char sccsid[] = "@(#)fvwrite.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/fvwrite.c,v 1.17 2004/06/08 05:45:48 das Exp $");
-
+__FBSDID("$FreeBSD: src/lib/libc/stdio/fvwrite.c,v 1.16 2004/03/02 19:43:51 jkh Exp $");
+
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -67,8 +68,10 @@
 	if ((len = uio->uio_resid) == 0)
 		return (0);
 	/* make sure we can write */
-	if (prepwrite(fp) != 0)
+	if (cantwrite(fp)) {
+		errno = EBADF;
 		return (EOF);
+	}
 
 #define	MIN(a, b) ((a) < (b) ? (a) : (b))
 #define	COPY(n)	  (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n))