File 0170-Close-mdfd-before-returning-main-function.patch of Package mdadm.12486

From 4dba4bd48f45a8df850ba3b37f3c2a5f178b163e Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Tue, 19 Sep 2017 14:06:46 +0800
Subject: [PATCH] Close mdfd before returning main function
Git-commit: 4dba4bd48f45a8df850ba3b37f3c2a5f178b163e
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 mdadm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mdadm.c b/mdadm.c
index d80aab3..7cdcdba 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1734,6 +1734,8 @@ int main(int argc, char *argv[])
 		autodetect();
 		break;
 	}
+	if (mdfd > 0)
+		close(mdfd);
 	exit(rv);
 }
 
-- 
2.13.6

openSUSE Build Service is sponsored by