svn commit: r319743 - vendor/illumos/dist/cmd/zdb
Andriy Gapon
avg at FreeBSD.org
Fri Jun 9 15:03:09 UTC 2017
Author: avg
Date: Fri Jun 9 15:03:07 2017
New Revision: 319743
URL: https://svnweb.freebsd.org/changeset/base/319743
Log:
8108 zdb -l fails to read labels 2 and 3
illumos/illumos-gate at 22c8b9583d07895c16549075a53668d7bc988cf3
https://github.com/illumos/illumos-gate/commit/22c8b9583d07895c16549075a53668d7bc988cf3
https://www.illumos.org/issues/8108
Reviewed by: Matthew Ahrens <mahrens at delphix.com>
Reviewed by: Toomas Soome <tsoome at me.com>
Reviewed by: Igor Kozhukhov <igor at dilos.org>
Reviewed by: Andrew Stormont <andyjstormont at gmail.com>
Approved by: Robert Mustacchi <rm at joyent.com>
Author: Yuri Pankov <yuri.pankov at nexenta.com>
Modified:
vendor/illumos/dist/cmd/zdb/zdb.c
Modified: vendor/illumos/dist/cmd/zdb/zdb.c
==============================================================================
--- vendor/illumos/dist/cmd/zdb/zdb.c Fri Jun 9 15:02:07 2017 (r319742)
+++ vendor/illumos/dist/cmd/zdb/zdb.c Fri Jun 9 15:03:07 2017 (r319743)
@@ -2299,24 +2299,29 @@ dump_label(const char *dev)
(void) snprintf(path, sizeof (path), "%s%s", ZFS_RDISK_ROOTD,
dev);
- if ((s = strrchr(dev, 's')) == NULL || !isdigit(*(s + 1)))
+ if (((s = strrchr(dev, 's')) == NULL &&
+ (s = strchr(dev, 'p')) == NULL) ||
+ !isdigit(*(s + 1)))
(void) strlcat(path, "s0", sizeof (path));
}
- if (stat64(path, &statbuf) != 0) {
- (void) printf("failed to stat '%s': %s\n", path,
+ if ((fd = open64(path, O_RDONLY)) < 0) {
+ (void) fprintf(stderr, "cannot open '%s': %s\n", path,
strerror(errno));
exit(1);
}
- if (S_ISBLK(statbuf.st_mode)) {
- (void) printf("cannot use '%s': character device required\n",
- path);
+ if (fstat64(fd, &statbuf) != 0) {
+ (void) fprintf(stderr, "failed to stat '%s': %s\n", path,
+ strerror(errno));
+ (void) close(fd);
exit(1);
}
- if ((fd = open64(path, O_RDONLY)) < 0) {
- (void) printf("cannot open '%s': %s\n", path, strerror(errno));
+ if (S_ISBLK(statbuf.st_mode)) {
+ (void) fprintf(stderr,
+ "cannot use '%s': character device required\n", path);
+ (void) close(fd);
exit(1);
}
More information about the svn-src-vendor
mailing list