look at size iff buff != NULL; fix from Chris Torek
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 14 Aug 1992 00:50:34 +0000 (16:50 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 14 Aug 1992 00:50:34 +0000 (16:50 -0800)
SCCS-vsn: lib/libc/stdio/setvbuf.c 5.3

usr/src/lib/libc/stdio/setvbuf.c

index 421b672..4952d69 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setvbuf.c  5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)setvbuf.c  5.3 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <stdio.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <stdio.h>
@@ -26,6 +26,8 @@ setvbuf(fp, buf, mode, size)
        register int mode;
        register size_t size;
 {
        register int mode;
        register size_t size;
 {
+       if (buf == NULL)
+               size = 0;
 
        /*
         * Verify arguments.  The `int' limit on `size' is due to this
 
        /*
         * Verify arguments.  The `int' limit on `size' is due to this