From fa9190091585054048f708e5d447b7db4ada7be7 Mon Sep 17 00:00:00 2001 From: Faruk Kasumovic Date: Tue, 25 Apr 2017 13:24:34 +0200 Subject: [PATCH] - Fix bug not fetching disk path in pool configuration when disk is unavailable (plugged off) --- zpool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zpool.go b/zpool.go index a8dfc6b..940f8b0 100644 --- a/zpool.go +++ b/zpool.go @@ -210,13 +210,13 @@ func poolGetConfig(name string, nv C.nvlist_ptr) (vdevs VDevTree, err error) { // Fetch the children if C.nvlist_lookup_nvlist_array(nv, C.sZPOOL_CONFIG_CHILDREN, unsafe.Pointer(&child), &children) != 0 { - return + children = 0 } if children > 0 { vdevs.Devices = make([]VDevTree, 0, children) } if C.nvlist_lookup_uint64(nv, C.sZPOOL_CONFIG_NOT_PRESENT, - ¬present) == 0 { + ¬present) == 0 || notpresent != 0 { var path C.char_ptr if 0 != C.nvlist_lookup_string(nv, C.sZPOOL_CONFIG_PATH, unsafe.Pointer(&path)) { err = fmt.Errorf("Failed to fetch %s", C.ZPOOL_CONFIG_PATH)