linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 1/2] super-intel.c: Don't try to close negative fd
Date: Fri,  4 May 2012 15:41:21 +0200	[thread overview]
Message-ID: <1336138882-31869-1-git-send-email-Jes.Sorensen@redhat.com> (raw)

From: Jes Sorensen <Jes.Sorensen@redhat.com>

This should be harmless, but lets be consistent and not try to close a
negative file descripter.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 super-intel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 2e85b6b..ca15703 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4353,7 +4353,7 @@ static int get_super_block(struct intel_super **super_list, int devnum, char *de
 	} else {
 		if (s)
 			free(s);
-		if (dfd)
+		if (dfd >= 0)
 			close(dfd);
 	}
 	if ((dfd >= 0) && (!keep_fd))
-- 
1.7.7.6


             reply	other threads:[~2012-05-04 13:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 13:41 Jes.Sorensen [this message]
2012-05-04 13:41 ` [PATCH 2/2] super-intel.c: Fix resource leak from opendir() Jes.Sorensen
2012-05-04 18:00 ` [PATCH 1/2] super-intel.c: Don't try to close negative fd Dan Williams
2012-05-06 23:10   ` 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=1336138882-31869-1-git-send-email-Jes.Sorensen@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).