From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH 2/2] mkfs.xfs: prevent close(-1) on protofile error path
Date: Mon, 14 Apr 2014 09:48:28 -0500 [thread overview]
Message-ID: <534BF53C.4000706@sandeen.net> (raw)
In-Reply-To: <534BF472.8030908@sandeen.net>
My previous cleanups introduced this; in the case where
fd=open() failed, the out_fail: path would try to close(-1).
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/mkfs/proto.c b/mkfs/proto.c
index 308325b..5a47e27 100644
--- a/mkfs/proto.c
+++ b/mkfs/proto.c
@@ -84,7 +84,8 @@ setup_proto(
return buf;
out_fail:
- close(fd);
+ if (fd >= 0)
+ close(fd);
free(buf);
exit(1);
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-04-14 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 14:45 [PATCH 0/2] xfsprogs: 2 quick coverity fixes Eric Sandeen
2014-04-14 14:46 ` [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi Eric Sandeen
2014-04-14 14:54 ` Mark Tinguely
2014-04-14 14:48 ` Eric Sandeen [this message]
2014-04-14 15:01 ` [PATCH 2/2] mkfs.xfs: prevent close(-1) on protofile error path Mark Tinguely
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=534BF53C.4000706@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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.