Module Name:    src
Committed By:   christos
Date:           Sun Jun 26 22:18:17 UTC 2011

Modified Files:
        src/lib/libc/db/recno: rec_put.c

Log Message:
- 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


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/db/recno/rec_put.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/db/recno/rec_put.c
diff -u src/lib/libc/db/recno/rec_put.c:1.18 src/lib/libc/db/recno/rec_put.c:1.19
--- src/lib/libc/db/recno/rec_put.c:1.18	Mon Jun 20 05:11:17 2011
+++ src/lib/libc/db/recno/rec_put.c	Sun Jun 26 18:18:16 2011
@@ -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;

Reply via email to