From: Keith Bostic Date: Wed, 24 Jun 1992 03:29:55 +0000 (-0800) Subject: make R_IAFTER of recno 0 work X-Git-Tag: BSD-4_4-Snapshot-Development~6545 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/f70146088c8f2fe876062cba466e3cff2e3fd0e1?ds=inline make R_IAFTER of recno 0 work SCCS-vsn: lib/libc/db/recno/rec_put.c 5.3 --- diff --git a/usr/src/lib/libc/db/recno/rec_put.c b/usr/src/lib/libc/db/recno/rec_put.c index aa5beb4824..302391037d 100644 --- a/usr/src/lib/libc/db/recno/rec_put.c +++ b/usr/src/lib/libc/db/recno/rec_put.c @@ -6,7 +6,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)rec_put.c 5.2 (Berkeley) %G%"; +static char sccsid[] = "@(#)rec_put.c 5.3 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include @@ -52,8 +52,13 @@ __rec_put(dbp, key, data, flags) goto einval; nrec = t->bt_rcursor; break; - case 0: case R_IAFTER: + if ((nrec = *(recno_t *)key->data) == 0) { + nrec = 1; + flags = R_IBEFORE; + } + break; + case 0: case R_IBEFORE: if ((nrec = *(recno_t *)key->data) == 0) goto einval; @@ -70,8 +75,8 @@ einval: errno = EINVAL; } /* - * Make sure that records up to and including the put record are already - * in the database. If skipping records, create empty ones. + * Make sure that records up to and including the put record are + * already in the database. If skipping records, create empty ones. */ if (nrec > t->bt_nrecs) { if (t->bt_irec(t, nrec) == RET_ERROR) @@ -80,8 +85,8 @@ einval: errno = EINVAL; tdata.data = NULL; tdata.size = 0; while (nrec > t->bt_nrecs) - if (__rec_iput(t, nrec, &tdata, 0) - != RET_SUCCESS) + if (__rec_iput(t, + nrec, &tdata, 0) != RET_SUCCESS) return (RET_ERROR); } }