mdadm/mdadm-3.4-Grow_continue_command-remove-dead-code.patch
Jes Sorensen 6e2d10d9a3 Backport various fixes for mdadm-3.4 from RHEL
Resolves: bz#1303380

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
2016-08-12 15:18:59 -04:00

52 lines
1.4 KiB
Diff

commit 12add44564f195878c3e346e4bbae845dec67db3
Author: Jes Sorensen <Jes.Sorensen@redhat.com>
Date: Fri Mar 4 16:30:22 2016 -0500
Grow: Grow_continue_command() remove dead code
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>
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);