]> granicus.if.org Git - zfs/commitdiff
Correctly parse -R flag arguments
authorTim Chase <tim@chase2k.com>
Wed, 3 Feb 2016 16:07:34 +0000 (10:07 -0600)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 5 Feb 2016 19:29:38 +0000 (11:29 -0800)
Currently, only the 'b' flag takes an argument which is an offset into
the block at which a blkptr should be decoded.  The index into the flag
string needed to be updated after parsing an argument.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4304

cmd/zdb/zdb.c

index c43d9d0bd68c2c833a9674c1b380d08750585757..cbc98d24c2f8065c33695dcb0e857c3f1cf05373 100644 (file)
@@ -3385,8 +3385,10 @@ zdb_read_block(char *thing, spa_t *spa)
                                continue;
 
                        p = &flagstr[i + 1];
-                       if (bit == ZDB_FLAG_PRINT_BLKPTR)
+                       if (bit == ZDB_FLAG_PRINT_BLKPTR) {
                                blkptr_offset = strtoull(p, &p, 16);
+                               i = p - &flagstr[i + 1];
+                       }
                        if (*p != ':' && *p != '\0') {
                                (void) printf("***Invalid flag arg: '%s'\n", s);
                                free(dup);