changeset 10857:2c20a0bd87cd

6892882 zdb -ddddd prints garbage from stack between dataset summary and rootbp 6892867 zdb can loop forever in dump_history() 6771708 zdb: Assertion failed: fill == bp->blk_fill (0x0 == 0x25), file ../zdb.c, line 671
author Victor Latushkin <Victor.Latushkin@Sun.COM>
date Sun, 25 Oct 2009 05:02:45 +0300
parents 1620845e5d2c
children 9efff268b959
files usr/src/cmd/zdb/zdb.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/zdb/zdb.c	Sat Oct 24 11:04:55 2009 -0700
+++ b/usr/src/cmd/zdb/zdb.c	Sun Oct 25 05:02:45 2009 +0300
@@ -540,8 +540,7 @@
 {
 	nvlist_t **events = NULL;
 	char buf[SPA_MAXBLOCKSIZE];
-	uint64_t resid, off = 0;
-	uint64_t len = sizeof (buf);
+	uint64_t resid, len, off = 0;
 	uint_t num = 0;
 	int error;
 	time_t tsec;
@@ -550,6 +549,8 @@
 	char internalstr[MAXPATHLEN];
 
 	do {
+		len = sizeof (buf);
+
 		if ((error = spa_history_get(spa, &off, &len, buf)) != 0) {
 			(void) fprintf(stderr, "Unable to read history: "
 			    "error %d\n", error);
@@ -673,7 +674,7 @@
 visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
     blkptr_t *bp, const zbookmark_t *zb)
 {
-	int err;
+	int err = 0;
 
 	if (bp->blk_birth == 0)
 		return (0);
@@ -1203,7 +1204,7 @@
 	nicenum(refdbytes, numbuf);
 
 	if (verbosity >= 4) {
-		(void) sprintf(blkbuf + strlen(blkbuf), ", rootbp ");
+		(void) sprintf(blkbuf, ", rootbp ");
 		(void) sprintf_blkptr(blkbuf + strlen(blkbuf),
 		    BP_SPRINTF_LEN - strlen(blkbuf), os->os_rootbp);
 	} else {