From: Jes Sorensen Date: Tue, 30 Jul 2013 16:30:03 +0000 (+0200) Subject: Avoid double close() X-Git-Tag: mdadm-3.3~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=364a48c9923c5164af848467c77aece080ba74fc;p=thirdparty%2Fmdadm.git 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 Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index c1ae6e83..ff4ed5dd 100644 --- a/Grow.c +++ b/Grow.c @@ -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;