summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sensorhandler.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 4fabac5..3a47e20 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -105,6 +105,13 @@ int legacy_dbus_openbmc_path(const char *type, const uint8_t num, dbus_interface
goto final;
}
+ if (strlen(str2) == 0)
+ {
+ // Path being empty occurs when the sensor id is not in SystemManager
+ r = -EINVAL;
+ goto final;
+ }
+
r = get_bus_for_path(str2, &str1);
if (r < 0) {
fprintf(stderr, "Failed to get %s busname: %s\n",
@@ -311,7 +318,7 @@ uint8_t find_type_for_sensor_number(uint8_t num) {
r = find_openbmc_path(num, &dbus_if);
if (r < 0) {
fprintf(stderr, "Could not find sensor %d\n", num);
- return r;
+ return 0;
}
return get_type_from_interface(dbus_if);
}
OpenPOWER on IntegriCloud