openhpi (2.14.1-1) src/init.c

Summary

 src/init.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

    
download this patch

Patch contents

--- openhpi-2.14.1.orig/src/init.c
+++ openhpi-2.14.1/src/init.c
@@ -11,6 +11,7 @@
  *
  * Author(s):
  *      Renier Morales <renier@openhpi.org>
+ *      Bryan Sutula <sutula@users.sourceforge.net>
  *
  */
 
@@ -37,6 +38,7 @@
         static int initialized = 0;
         struct oh_parsed_config config = { NULL, 0, 0 };
         struct oh_global_param config_param = { .type = OPENHPI_CONF };
+        struct oh_global_param unconf_param = { .type = OPENHPI_UNCONFIGURED };
         SaErrorT rval;
 
         data_access_lock();
@@ -66,6 +68,16 @@
                 return SA_ERR_HPI_NOT_PRESENT;
         }
 
+	/* One particular variable, OPENHPI_UNCONFIGURED, can cause us to exit
+	 * immediately, without trying to run the daemon any further.
+	 */
+	oh_get_global_param(&unconf_param);
+	if (unconf_param.u.unconfigured) {
+                err("OpenHPI is not configured.  See openhpi.conf file.");
+                data_access_unlock();
+                return SA_ERR_HPI_ERROR;
+	}
+
         /* Initialize uid_utils */
         rval = oh_uid_initialize();
         if( (rval != SA_OK) && (rval != SA_ERR_HPI_ERROR) ) {