[PATCH 1/4] lib: fwts_ipmi: don't close a -ve fd on error exit return path
Colin King
colin.king at canonical.com
Tue May 31 10:42:35 UTC 2016
From: Colin Ian King <colin.king at canonical.com>
Since the open failed, fd is negative, so the close does not
need to be performed; remove it.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_ipmi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lib/src/fwts_ipmi.c b/src/lib/src/fwts_ipmi.c
index 737f6fa..f5f5a56 100644
--- a/src/lib/src/fwts_ipmi.c
+++ b/src/lib/src/fwts_ipmi.c
@@ -18,7 +18,9 @@
*
*/
-#include <sys/fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/poll.h>
#include <sys/ioctl.h>
#include <linux/ipmi.h>
@@ -43,10 +45,8 @@ int fwts_ipmi_exec_query(
struct ipmi_addr fwts_ipmi_addr;
struct pollfd fwts_pfd;
- if ((fd = open(fwts_ipmi_devnode, O_RDWR)) < 0){
- close(fd);
+ if ((fd = open(fwts_ipmi_devnode, O_RDWR)) < 0)
return FWTS_ERROR;
- };
fwts_send_rc = ioctl(fd, IPMICTL_SEND_COMMAND, (char *)fwts_ipmi_req);
--
2.8.1
More information about the fwts-devel
mailing list