From 0423bf4e64c89426584960d324f94921ed5336c3 Mon Sep 17 00:00:00 2001
From: Albert Chu <chu11@llnl.gov>
Date: Wed, 12 Dec 2018 13:44:46 -0800
Subject: [PATCH] contrib: Fix corner case libipmimonitoring-sensors output

---
 contrib/libipmimonitoring/ipmimonitoring-sensors.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/contrib/libipmimonitoring/ipmimonitoring-sensors.c b/contrib/libipmimonitoring/ipmimonitoring-sensors.c
index 55001debc..7cf5db58b 100644
--- a/contrib/libipmimonitoring/ipmimonitoring-sensors.c
+++ b/contrib/libipmimonitoring/ipmimonitoring-sensors.c
@@ -441,13 +441,10 @@ _ipmimonitoring (struct ipmi_monitoring_ipmi_config *ipmi_config)
           goto cleanup;
         }
 
-      if (!(sensor_bitmask_strings = ipmi_monitoring_sensor_read_sensor_bitmask_strings (ctx)))
-        {
-          fprintf (stderr,
-                   "ipmi_monitoring_sensor_read_sensor_bitmask_strings: %s\n",
-                   ipmi_monitoring_ctx_errormsg (ctx));
-          goto cleanup;
-        }
+      /* it's ok for this to be NULL, i.e. sensor_bitmask ==
+       * IPMI_MONITORING_SENSOR_BITMASK_TYPE_UNKNOWN
+       */
+      sensor_bitmask_strings = ipmi_monitoring_sensor_read_sensor_bitmask_strings (ctx);
 
       if ((sensor_reading_type = ipmi_monitoring_sensor_read_sensor_reading_type (ctx)) < 0)
         {
@@ -541,7 +538,8 @@ _ipmimonitoring (struct ipmi_monitoring_ipmi_config *ipmi_config)
       else
         printf (", N/A");
 
-      if (sensor_bitmask_type != IPMI_MONITORING_SENSOR_BITMASK_TYPE_UNKNOWN)
+      if (sensor_bitmask_type != IPMI_MONITORING_SENSOR_BITMASK_TYPE_UNKNOWN
+          && sensor_bitmask_strings)
         {
           unsigned int i = 0;
 
-- 
2.33.0

