key gets filled in by seq call, should point at something
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 18 Jul 1992 00:43:18 +0000 (16:43 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 18 Jul 1992 00:43:18 +0000 (16:43 -0800)
lseek takes an off_t, not a long

SCCS-vsn: lib/libc/db/recno/rec_close.c 5.4

usr/src/lib/libc/db/recno/rec_close.c

index 97d0dec..5888a99 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_close.c        5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)rec_close.c        5.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -67,7 +67,7 @@ __rec_sync(dbp)
        BTREE *t;
        DBT data, key;
        off_t off;
        BTREE *t;
        DBT data, key;
        off_t off;
-       recno_t scursor;
+       recno_t scursor, trec;
        int status;
 
        t = dbp->internal;
        int status;
 
        t = dbp->internal;
@@ -85,13 +85,16 @@ __rec_sync(dbp)
                return (RET_ERROR);
 
        /* Rewind the file descriptor. */
                return (RET_ERROR);
 
        /* Rewind the file descriptor. */
-       if (lseek(t->bt_rfd, 0L, SEEK_SET) != 0L)
+       if (lseek(t->bt_rfd, (off_t)0, SEEK_SET) != 0L)
                return (RET_ERROR);
 
        iov[1].iov_base = "\n";
        iov[1].iov_len = 1;
        scursor = t->bt_rcursor;
 
                return (RET_ERROR);
 
        iov[1].iov_base = "\n";
        iov[1].iov_len = 1;
        scursor = t->bt_rcursor;
 
+       key.size = sizeof(recno_t);
+       key.data = &trec;
+
        status = (dbp->seq)(dbp, &key, &data, R_FIRST);
         while (status == RET_SUCCESS) {
                iov[0].iov_base = data.data;
        status = (dbp->seq)(dbp, &key, &data, R_FIRST);
         while (status == RET_SUCCESS) {
                iov[0].iov_base = data.data;
@@ -103,7 +106,7 @@ __rec_sync(dbp)
        t->bt_rcursor = scursor;
        if (status == RET_ERROR)
                return (RET_ERROR);
        t->bt_rcursor = scursor;
        if (status == RET_ERROR)
                return (RET_ERROR);
-       if ((off = lseek(t->bt_rfd, 0L, SEEK_CUR)) == -1)
+       if ((off = lseek(t->bt_rfd, (off_t)0, SEEK_CUR)) == -1)
                return (RET_ERROR);
        if (ftruncate(t->bt_rfd, off))
                return (RET_ERROR);
                return (RET_ERROR);
        if (ftruncate(t->bt_rfd, off))
                return (RET_ERROR);