summaryrefslogtreecommitdiff
path: root/usr/src/cmd/fs.d/zfs
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2020-08-13 15:27:11 +0100
committerGitHub <noreply@github.com>2020-08-13 15:27:11 +0100
commite63d036fd36b5642d5e199f7d9895d8d4eda6072 (patch)
tree0c177a62e8bd3796a7b530b7520fb0a4e7d0cd56 /usr/src/cmd/fs.d/zfs
parenta8ff5009e5f7ea544c79b60ea65577f19304ff0b (diff)
parent09f210323354e07890b312da9b4f5e33ae6b6df5 (diff)
downloadillumos-joyent-sasinfo.tar.gz
Merge branch 'master' into sasinfosasinfo
Diffstat (limited to 'usr/src/cmd/fs.d/zfs')
-rw-r--r--usr/src/cmd/fs.d/zfs/fstyp/fstyp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
index d49d998404..2e7d4d397d 100644
--- a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
+++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <sys/debug.h>
#include <sys/types.h>
#include <unistd.h>
#include <libintl.h>
@@ -89,11 +90,17 @@ fstyp_mod_ident(fstyp_mod_handle_t handle)
char *str;
uint64_t u64;
char buf[64];
+ int num_labels = 0;
- if (zpool_read_label(h->fd, &h->config, NULL) != 0) {
- return (FSTYP_ERR_NO_MATCH);
+ if (zpool_read_label(h->fd, &h->config, &num_labels) != 0) {
+ /* This is the only reason zpool_read_label() can fail */
+ VERIFY3S(errno, ==, ENOMEM);
+ return (FSTYP_ERR_NOMEM);
}
+ if (num_labels == 0)
+ return (FSTYP_ERR_NO_MATCH);
+
if (nvlist_lookup_uint64(h->config, ZPOOL_CONFIG_POOL_STATE,
&state) != 0 || state == POOL_STATE_DESTROYED) {
nvlist_free(h->config);