]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/wbuf.c
Libc-1439.100.3.tar.gz
[apple/libc.git] / stdio / FreeBSD / wbuf.c
index 4f1c4aaea36fa495bbd2b2391165cb8c6bd1d589..9e9b59eaedc49dfeb3ef3764cac3c4fbfb494057 100644 (file)
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)wbuf.c    8.1 (Berkeley) 6/4/93";
 __FBSDID("$FreeBSD: src/lib/libc/stdio/wbuf.c,v 1.12 2007/01/09 00:28:08 imp Exp $");
 
 #include <stdio.h>
+#include <errno.h>
 #include "local.h"
 
 /*
@@ -61,8 +62,10 @@ __swbuf(c, fp)
         * calls might wrap _w from negative to positive.
         */
        fp->_w = fp->_lbfsize;
-       if (prepwrite(fp) != 0)
+       if (prepwrite(fp) != 0) {
+               errno = EBADF;
                return (EOF);
+       }
        c = (unsigned char)c;
 
        ORIENT(fp, -1);