File 0016-Grow-Grow_continue_command-remove-dead-code.patch of Package mdadm.7129

From 12add44564f195878c3e346e4bbae845dec67db3 Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Fri, 4 Mar 2016 16:30:22 -0500
Subject: [PATCH 237/359] Grow: Grow_continue_command() remove dead code
References: bsc#1081910

All cases where fd2 is used are completed with a close(fd2), so there
is no need to set fd2 = -1 or check for it before exiting.

Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 Grow.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/Grow.c b/Grow.c
index c4f417e..c4af5c0 100755
--- a/Grow.c
+++ b/Grow.c
@@ -4752,7 +4752,7 @@ int Grow_continue_command(char *devname, int fd,
 	struct mdinfo *cc = NULL;
 	struct mdstat_ent *mdstat = NULL;
 	int cfd = -1;
-	int fd2 = -1;
+	int fd2;
 
 	dprintf("Grow continue from command line called for %s\n",
 		devname);
@@ -4796,8 +4796,6 @@ int Grow_continue_command(char *devname, int fd,
 				continue;
 			err = st->ss->load_super(st, fd2, NULL);
 			close(fd2);
-			/* invalidate fd2 to avoid possible double close() */
-			fd2 = -1;
 			if (err)
 				continue;
 			break;
@@ -4894,7 +4892,6 @@ int Grow_continue_command(char *devname, int fd,
 		sysfs_init(content, fd2, mdstat->devnm);
 
 		close(fd2);
-		fd2 = -1;
 
 		/* start mdmon in case it is not running
 		 */
@@ -4924,8 +4921,6 @@ int Grow_continue_command(char *devname, int fd,
 	ret_val = Grow_continue(fd, st, content, backup_file, 1, 0);
 
 Grow_continue_command_exit:
-	if (fd2 > -1)
-		close(fd2);
 	if (cfd > -1)
 		close(cfd);
 	st->ss->free_super(st);
-- 
2.16.1

openSUSE Build Service is sponsored by