SCCS-vsn: lib/libc/stdio/findfp.c 5.2
-static char sccsid[] = "@(#)findfp.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)findfp.c 5.2 (Berkeley) %G%";
#endif not lint
#include <stdio.h>
#endif not lint
#include <stdio.h>
+#include <errno.h>
+
+extern int errno;
#define active(iop) ((iop)->_flag & (_IOREAD|_IOWRT|_IORW))
#define active(iop) ((iop)->_flag & (_IOREAD|_IOWRT|_IORW))
iov = iobglue;
while (*iov != NULL && active(*iov))
iov = iobglue;
while (*iov != NULL && active(*iov))
+ if (++iov >= endglue) {
+ errno = EMFILE;
if (*iov == NULL)
*iov = (FILE *)calloc(1, sizeof **iov);
if (*iov == NULL)
*iov = (FILE *)calloc(1, sizeof **iov);