zdb -l fix

From: Hidetoshi Shimokawa <simokawa_at_FreeBSD.ORG>
Date: Fri, 3 Aug 2007 23:37:30 +0900
Hi,

Current "zdb -l dev" causes errors on label 2 and 3.
The following patch fixes the problem.
It may be better to be incorporated into 7.0.
Thanks,

Index: src/contrib/opensolaris/cmd/zdb/zdb.c
===================================================================
--- src.orig/contrib/opensolaris/cmd/zdb/zdb.c  2007-08-02
01:25:16.000000000 +0900
+++ src/contrib/opensolaris/cmd/zdb/zdb.c       2007-08-03
23:28:06.475733977 +0900
_at__at_ -1136,7 +1136,11 _at__at_
                exit(1);
        }

-       psize = statbuf.st_size;
+       if (S_ISCHR(statbuf.st_mode))
+               ioctl(fd, DIOCGMEDIASIZE, &psize);
+       else
+               psize = statbuf.st_size;
+
        psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t));

        for (l = 0; l < VDEV_LABELS; l++) {

-- 
/\ Hidetoshi Shimokawa
\/  simokawa_at_FreeBSD.ORG
Received on Fri Aug 03 2007 - 13:05:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC