Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/db/recno - Fix bug copying only 1 byte instead of t...



details:   https://anonhg.NetBSD.org/src/rev/70648f2fb985
branches:  trunk
changeset: 766543:70648f2fb985
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Jun 26 22:18:16 2011 +0000

description:
- Fix bug copying only 1 byte instead of the whole page number. Broke nvi
  joining lines that needed R_BIGDATA.
- Fix from FreeBSD for nrec IAFTER.
XXX: Should be pulled up to 5.x

diffstat:

 lib/libc/db/recno/rec_put.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 0a0fbceeb624 -r 70648f2fb985 lib/libc/db/recno/rec_put.c
--- a/lib/libc/db/recno/rec_put.c       Sun Jun 26 22:16:46 2011 +0000
+++ b/lib/libc/db/recno/rec_put.c       Sun Jun 26 22:18:16 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rec_put.c,v 1.18 2011/06/20 09:11:17 mrg Exp $ */
+/*     $NetBSD: rec_put.c,v 1.19 2011/06/26 22:18:16 christos Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_put.c,v 1.18 2011/06/20 09:11:17 mrg Exp $");
+__RCSID("$NetBSD: rec_put.c,v 1.19 2011/06/26 22:18:16 christos Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -167,8 +167,14 @@
        if ((status = __rec_iput(t, nrec - 1, &fdata, flags)) != RET_SUCCESS)
                return (status);
 
-       if (flags == R_SETCURSOR)
+       switch (flags) {
+       case R_IAFTER:
+               nrec++;
+               break;
+       case R_SETCURSOR:
                t->bt_cursor.rcursor = nrec;
+               break;
+       }
        
        F_SET(t, R_MODIFIED);
        return (__rec_ret(t, NULL, nrec, key, NULL));
@@ -208,7 +214,7 @@
                        return (RET_ERROR);
                tdata.data = db;
                tdata.size = NOVFLSIZE;
-               memcpy(db, &pg, sizeof(*db));
+               memcpy(db, &pg, sizeof(pg));
                _DBFIT(data->size, uint32_t);
                *(uint32_t *)(void *)(db + sizeof(pgno_t)) =
                    (uint32_t)data->size;



Home | Main Index | Thread Index | Old Index