Correct compilation errors
Fix compilation errors found with later gcc version during integration
unit tests.
Resolves openbmc/phosphor-host-ipmid#101
Change-Id: I35c5433f03521a877fd09748b8262d6172d21535
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/storageaddsel.cpp b/storageaddsel.cpp
index 87018e7..84e3092 100644
--- a/storageaddsel.cpp
+++ b/storageaddsel.cpp
@@ -53,21 +53,21 @@
dbus_interface_t a;
const char *p;
- char r;
+ int r;
r = find_openbmc_path("SENSOR", sensor_number, &a);
if ((r < 0) || (a.bus[0] == 0)) {
// Just make a generic message for errors that
// occur on sensors that dont exist
- asprintf(s, "Unknown Sensor (0x%02x)", sensor_number);
+ r = asprintf(s, "Unknown Sensor (0x%02x)", sensor_number);
} else {
if ((p = strrchr (a.path, '/')) == NULL) {
p = "/Unknown Sensor";
}
- asprintf(s, "%s", p+1);
+ *s = strdup(p+1);
}
return 0;
@@ -145,7 +145,7 @@
memset(dbusint.path,0,sizeof(dbusint.path));
}
- asprintf(m, "%s", dbusint.path);
+ *m = strdup(dbusint.path);
return 0;
}
@@ -157,12 +157,17 @@
ipmi_add_sel_request_t *p;
char *m;
+ int r;
p = ( ipmi_add_sel_request_t *) buffer;
find_sensor_type_string(p->sensornumber,&m);
- asprintf(message, "A %s has experienced a %s", m, sev );
+ r = asprintf(message, "A %s has experienced a %s", m, sev );
+ if (r == -1) {
+ fprintf(stderr,
+ "Failed to allocate memory for ESEL description\n");
+ }
free(m);