From: Steve Dickson <SteveD@redhat.com>
To: Vivek Trivedi <t.vivek@samsung.com>, linux-nfs@vger.kernel.org
Cc: a.sahrawat@samsung.com, pankaj.m@samsung.com
Subject: Re: [PATCH 1/2] nfs-utils: libnsm.a: do not close file if open failed
Date: Wed, 2 Dec 2015 11:11:08 -0500 [thread overview]
Message-ID: <565F181C.201@RedHat.com> (raw)
In-Reply-To: <1449054998-19308-1-git-send-email-t.vivek@samsung.com>
On 12/02/2015 06:16 AM, Vivek Trivedi wrote:
> If file open failed, no need to issue close system call in
> nsm_get_state and closeall.
I guess this makes sense... but what problem is this patch fixing?
steved.
>
> Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
> ---
> support/nfs/closeall.c | 3 ++-
> support/nsm/file.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/support/nfs/closeall.c b/support/nfs/closeall.c
> index 38fb162..a69bf35 100644
> --- a/support/nfs/closeall.c
> +++ b/support/nfs/closeall.c
> @@ -31,6 +31,7 @@ closeall(int min)
> } else {
> int fd = sysconf(_SC_OPEN_MAX);
> while (--fd >= min)
> - (void) close(fd);
> + if(fd >= 0)
> + (void) close(fd);
> }
> }
> diff --git a/support/nsm/file.c b/support/nsm/file.c
> index 4711c2c..7a8b504 100644
> --- a/support/nsm/file.c
> +++ b/support/nsm/file.c
> @@ -536,7 +536,8 @@ nsm_get_state(_Bool update)
> state++;
>
> update:
> - (void)close(fd);
> + if(fd >= 0)
> + (void)close(fd);
>
> if (update) {
> state += 2;
>
next prev parent reply other threads:[~2015-12-02 16:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 11:16 [PATCH 1/2] nfs-utils: libnsm.a: do not close file if open failed Vivek Trivedi
2015-12-02 11:16 ` [PATCH 2/2] nfs-utils: mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostname Vivek Trivedi
2015-12-02 16:16 ` Steve Dickson
2015-12-03 15:22 ` Vivek Trivedi
2015-12-12 12:12 ` Steve Dickson
2015-12-02 16:11 ` Steve Dickson [this message]
2015-12-03 15:21 ` [PATCH 1/2] nfs-utils: libnsm.a: do not close file if open failed Vivek Trivedi
2015-12-12 12:11 ` Steve Dickson
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=565F181C.201@RedHat.com \
--to=steved@redhat.com \
--cc=a.sahrawat@samsung.com \
--cc=linux-nfs@vger.kernel.org \
--cc=pankaj.m@samsung.com \
--cc=t.vivek@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.