| To: | xfs-oss <xfs@xxxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH 2/2] mkfs.xfs: prevent close(-1) on protofile error path |
| From: | Eric Sandeen <sandeen@xxxxxxxxxxx> |
| Date: | Mon, 14 Apr 2014 09:48:28 -0500 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <534BF472.8030908@xxxxxxxxxxx> |
| References: | <534BF472.8030908@xxxxxxxxxxx> |
| User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
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@xxxxxxxxxx>
---
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);
}
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi, Eric Sandeen |
|---|---|
| Next by Date: | Re: [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi, Mark Tinguely |
| Previous by Thread: | Re: [PATCH 1/2] xfs_logprint: Fix error handling in xlog_print_trans_efi, Mark Tinguely |
| Next by Thread: | Re: [PATCH 2/2] mkfs.xfs: prevent close(-1) on protofile error path, Mark Tinguely |
| Indexes: | [Date] [Thread] [Top] [All Lists] |