File 1003-bnc966773_detail-ignore_empty_inactive_arrays.patch of Package mdadm.7129

Subject: Detail: ignore empty inactive arrays
References: bsc#966773

---
 Detail.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/Detail.c
+++ b/Detail.c
@@ -110,6 +110,14 @@ int Detail(char *dev, struct context *c)
 	if (ioctl(fd, GET_ARRAY_INFO, &array) == 0) {
 		inactive = 0;
 	} else if (errno == ENODEV && sra) {
+		if (sra->array.major_version == -1 &&
+		    sra->array.minor_version == -1 &&
+		    sra->devs == NULL) {
+			pr_err("Array associated with md device %s does not exist.\n", dev);
+			close(fd);
+			sysfs_free(sra);
+			return rv;
+		}
 		array = sra->array;
 		inactive = 1;
 	} else {
openSUSE Build Service is sponsored by