From: Keith Bostic Date: Sun, 20 Dec 1992 07:24:15 +0000 (-0800) Subject: read slowly if can't mmap the file X-Git-Tag: BSD-4_4-Snapshot-Development~3956 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/b59a7d4221507f34ac77b1deda6777307df5874c read slowly if can't mmap the file SCCS-vsn: lib/libc/db/recno/rec_open.c 5.12 --- diff --git a/usr/src/lib/libc/db/recno/rec_open.c b/usr/src/lib/libc/db/recno/rec_open.c index d44c9c0e65..8511cfb4ee 100644 --- a/usr/src/lib/libc/db/recno/rec_open.c +++ b/usr/src/lib/libc/db/recno/rec_open.c @@ -9,7 +9,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_open.c 5.11 (Berkeley) %G%"; +static char sccsid[] = "@(#)rec_open.c 5.12 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include @@ -92,7 +92,7 @@ __rec_open(fname, flags, mode, openinfo) if (fname != NULL) if (lseek(rfd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) { SET(t, BTF_RDONLY); - if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) +slow: if ((t->bt_rfp = fdopen(rfd, "r")) == NULL) goto err; t->bt_irec = ISSET(t, BTF_FIXEDLEN) ? __rec_fpipe : __rec_vpipe; @@ -116,7 +116,7 @@ __rec_open(fname, flags, mode, openinfo) } if ((t->bt_smap = mmap(NULL, (size_t)sb.st_size, PROT_READ, 0, rfd, (off_t)0)) == (caddr_t)-1) - goto err; + goto slow; t->bt_emap = t->bt_smap + sb.st_size; t->bt_rfd = rfd; t->bt_rfp = NULL;