SCCS-vsn: lib/libc/stdio/fopen.c 4.3
SCCS-vsn: lib/libc/stdio/fdopen.c 4.4
-/* @(#)fdopen.c 4.3 (Berkeley) %G% */
+/* @(#)fdopen.c 4.4 (Berkeley) %G% */
/*
* Unix routine to do an "fopen" on file descriptor
* The mode has to be repeated because you can't query its
/*
* Unix routine to do an "fopen" on file descriptor
* The mode has to be repeated because you can't query its
if ((unsigned)fd >= getdtablesize())
return (NULL);
if ((unsigned)fd >= getdtablesize())
return (NULL);
- 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);
iop->_cnt = 0;
iop->_file = fd;
return(NULL);
iop->_cnt = 0;
iop->_file = fd;
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] == '+';