require the cursor be initialized before deleting using R_CURSOR
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 14 Nov 1992 09:25:15 +0000 (01:25 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 14 Nov 1992 09:25:15 +0000 (01:25 -0800)
SCCS-vsn: lib/libc/db/btree/bt_delete.c 5.6

usr/src/lib/libc/db/btree/bt_delete.c

index 400d867..e2598f8 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_delete.c        5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)bt_delete.c        5.6 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -59,11 +59,13 @@ __bt_delete(dbp, key, flags)
                 * the delete cursor bit to have been set requires that the
                 * scan be initialized, so no reason to check.
                 */
                 * the delete cursor bit to have been set requires that the
                 * scan be initialized, so no reason to check.
                 */
+               if (!ISSET(t, BTF_SEQINIT))
+                        goto einval;
                status = ISSET(t, BTF_DELCRSR) ?
                    RET_SPECIAL : __bt_crsrdel(t, &t->bt_bcursor);
                break;
        default:
                status = ISSET(t, BTF_DELCRSR) ?
                    RET_SPECIAL : __bt_crsrdel(t, &t->bt_bcursor);
                break;
        default:
-               errno = EINVAL;
+einval:                errno = EINVAL;
                return (RET_ERROR);
        }
        if (status == RET_SUCCESS)
                return (RET_ERROR);
        }
        if (status == RET_SUCCESS)