Avoid double close()

Coverity discovered a possible double close(fd2) in Grow.c. Avoided by
invalidating fd2 after the first close.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2013-07-30 18:30:03 +02:00 committed by NeilBrown
parent 23bf42cc79
commit 364a48c992
1 changed files with 2 additions and 0 deletions

2
Grow.c
View File

@ -4685,6 +4685,8 @@ 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;