summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2014-01-11 06:45:44 +0000
committerPetter Reinholdtsen <pere@hungry.com>2014-01-11 06:45:44 +0000
commit4e220bebb075b432df474183c50170f5ea12641e (patch)
tree4a190b77d4d13f7c91f1ddfccdbdbfe8563f2b22
parent4698e667f5abbac30eda481d06d0602654240b27 (diff)
downloadipmitool-4e220bebb075b432df474183c50170f5ea12641e.tar.gz
Check return value from open() in ipmi_start_daemon() (Coverity CID CID 1148983).
-rw-r--r--ipmitool/lib/helper.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c
index 546c760..4b903b0 100644
--- a/ipmitool/lib/helper.c
+++ b/ipmitool/lib/helper.c
@@ -44,6 +44,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <assert.h>
#if HAVE_CONFIG_H
# include <config.h>
@@ -663,9 +664,10 @@ ipmi_start_daemon(struct ipmi_intf *intf)
close(fd);
}
- open("/dev/null", O_RDWR);
- dup(0);
- dup(0);
+ fd = open("/dev/null", O_RDWR);
+ assert(0 == fd);
+ dup(fd);
+ dup(fd);
}
/* is_fru_id - wrapper for str-2-int FRU ID conversion. Message is printed