]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: Grow_continue_command() remove dead code
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 4 Mar 2016 21:30:22 +0000 (16:30 -0500)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Wed, 9 Mar 2016 16:35:34 +0000 (11:35 -0500)
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>
Grow.c

diff --git a/Grow.c b/Grow.c
index c4f417ee283527c86f7344a4df7396c0541625ab..c4af5c031c410104befe2c581172013e77acf423 100755 (executable)
--- 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);