Signed-off-by: Xiao Ni <xni@xxxxxxxxxx> --- mdmon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mdmon.c b/mdmon.c index b8f71e5db555..f0e89924aef7 100644 --- a/mdmon.c +++ b/mdmon.c @@ -455,11 +455,13 @@ static int mdmon(char *devnm, int must_fork, int takeover) if (must_fork) { if (pipe(pfd) != 0) { pr_err("failed to create pipe\n"); + close(mdfd); return 1; } switch(fork()) { case -1: pr_err("failed to fork: %s\n", strerror(errno)); + close(mdfd); return 1; case 0: /* child */ close(pfd[0]); @@ -471,6 +473,7 @@ static int mdmon(char *devnm, int must_fork, int takeover) status = WEXITSTATUS(status); } close(pfd[0]); + close(mdfd); return status; } } else -- 2.32.0 (Apple Git-132)