linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: Xiao Ni <xni@redhat.com>, linux-raid@vger.kernel.org
Cc: neilb@suse.com
Subject: Re: [MDADM PATCH 1/2] Close mdfd before returning main function
Date: Mon, 2 Oct 2017 13:27:23 -0400	[thread overview]
Message-ID: <0082c26c-d97f-d2a9-6596-3f819c3366a8@gmail.com> (raw)
In-Reply-To: <1505801207-10096-2-git-send-email-xni@redhat.com>

On 09/19/2017 02:06 AM, Xiao Ni wrote:
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
>   mdadm.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/mdadm.c b/mdadm.c
> index d80aab3..7cdcdba 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1734,6 +1734,8 @@ int main(int argc, char *argv[])
>   		autodetect();
>   		break;
>   	}
> +	if (mdfd > 0)
> +		close(mdfd);
>   	exit(rv);
>   }

While technically not necessary, since exit() will result in file 
descriptors for the process getting closed, I do prefer to have the code 
clean up properly after itself. I have gone ahead and applied this one.

Cheers,
Jes



  reply	other threads:[~2017-10-02 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  6:06 [MDADM PATCH 0/2] /dev/md0 can't be released immediatly Xiao Ni
2017-09-19  6:06 ` [MDADM PATCH 1/2] Close mdfd before returning main function Xiao Ni
2017-10-02 17:27   ` Jes Sorensen [this message]
2017-09-19  6:06 ` [MDADM PATCH 2/2] Give enough time to udev to handle events Xiao Ni
2017-09-19  6:49   ` NeilBrown
2017-09-30  8:14     ` Xiao Ni
2017-10-02 17:28     ` Jes Sorensen
2017-10-02 23:00       ` NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0082c26c-d97f-d2a9-6596-3f819c3366a8@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=xni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).