summaryrefslogtreecommitdiff
path: root/src/plugins/dummy/dummy.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 22:59:06 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-05-08 22:59:06 +0200
commita7c8ed90be739a49937a229828c470f1ad01396e (patch)
tree4cd43ff357d98a1ce5afb3bb9449afcce5a299d1 /src/plugins/dummy/dummy.c
parentfa5ac2da06fae952fe1295a1e955bdb35e6d86c4 (diff)
parent342ebce798fe98ede64939a49bbc3770d8214649 (diff)
Merge tag 'upstream/1.8.17'
Upstream version 1.8.17
Diffstat (limited to 'src/plugins/dummy/dummy.c')
-rw-r--r--src/plugins/dummy/dummy.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/dummy/dummy.c b/src/plugins/dummy/dummy.c
index 8bfc4cf..8600a84 100644
--- a/src/plugins/dummy/dummy.c
+++ b/src/plugins/dummy/dummy.c
@@ -31,6 +31,7 @@
#include <errno.h>
#include <limits.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
@@ -175,6 +176,14 @@ ipmi_dummyipmi_open(struct ipmi_intf *intf)
struct sockaddr_un address;
int len;
int rc;
+ char *dummy_sock_path;
+
+ dummy_sock_path = getenv("IPMI_DUMMY_SOCK");
+ if (dummy_sock_path == NULL) {
+ lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON.");
+ intf->opened = 1;
+ return intf->fd;
+ }
if (intf->opened == 1) {
return intf->fd;
@@ -185,7 +194,7 @@ ipmi_dummyipmi_open(struct ipmi_intf *intf)
return (-1);
}
address.sun_family = AF_UNIX;
- strcpy(address.sun_path, DUMMY_SOCKET_PATH);
+ strcpy(address.sun_path, dummy_sock_path);
len = sizeof(address);
rc = connect(intf->fd, (struct sockaddr *)&address, len);
if (rc != 0) {
@@ -209,6 +218,12 @@ ipmi_dummyipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
static struct ipmi_rs rsp;
struct dummy_rq req_dummy;
struct dummy_rs rsp_dummy;
+ char *dummy_sock_path;
+ dummy_sock_path = getenv("IPMI_DUMMY_SOCK");
+ if (dummy_sock_path == NULL) {
+ lprintf(LOG_DEBUG, "No IPMI_DUMMY_SOCK set. Dummy mode ON.");
+ return NULL;
+ }
if (intf == NULL || intf->fd < 0 || intf->opened != 1) {
lprintf(LOG_ERR, "dummy failed on intf check.");
return NULL;