BSD 4_2 release
[unix-history] / usr / src / lib / libc / stdio / fopen.c
index 94fd358..ce31301 100644 (file)
@@ -1,4 +1,4 @@
-/* @(#)fopen.c 4.2 (Berkeley) 3/9/81 */
+/* @(#)fopen.c 4.3 (Berkeley) 9/12/83 */
 #include       <stdio.h>
 #include       <errno.h>
 
 #include       <stdio.h>
 #include       <errno.h>
 
@@ -12,8 +12,8 @@ register char *mode;
        register FILE *iop;
        extern FILE *_lastbuf;
 
        register FILE *iop;
        extern FILE *_lastbuf;
 
-       for (iop = _iob; iop->_flag&(_IOREAD|_IOWRT|_IORW); iop++)
-               if (iop >= _lastbuf)
+       for (iop = _iob; iop->_flag&(_IOREAD|_IOWRT|_IORW); )
+               if (++iop >= _lastbuf)
                        return(NULL);
 
        rw = mode[1] == '+';
                        return(NULL);
 
        rw = mode[1] == '+';