From 364a48c9923c5164af848467c77aece080ba74fc Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 30 Jul 2013 18:30:03 +0200 Subject: [PATCH] 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 --- Grow.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.39.2