---
 src/ntf/ntfimcnd/ntfimcn_imm.c | 48 ++++++++++++------------------------------
 1 file changed, 14 insertions(+), 34 deletions(-)

diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c
index 1358d9f..172491d 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -175,23 +175,16 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
        s_get_rdn_attr_name.saved_className =
            realloc(s_get_rdn_attr_name.saved_className, strlen(className) + 1);
        if (s_get_rdn_attr_name.saved_className == NULL) {
-               LOG_ER("Failed to realloc memory");
-               goto error;
+               LOG_ER("%s: Failed to realloc memory",__FUNCTION__);
+               osaf_abort(0);
        }
        memcpy(s_get_rdn_attr_name.saved_className, className,
               strlen(className) + 1);
 
-       /* Get an IMM OM Handle */
-       SaImmHandleT immOmHandle = 0;
-       if (initializeImmOmHandle(&immOmHandle) == false) {
-               LOG_ER("getImmOmHandle() Fail");
-               goto error;
-       }
-
        /* Get class description */
        rc = getClassDescription(className, &attrDescr);
        if (rc != SA_AIS_OK) {
-               LOG_ER("getClassDescription failed %s", saf_error(rc));
+               LOG_NO("getClassDescription failed %s", saf_error(rc));
                goto error;
        }
 
@@ -202,8 +195,8 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
                            realloc(s_get_rdn_attr_name.attrName,
                                    strlen(attrDescr[i]->attrName) + 1);
                        if (s_get_rdn_attr_name.attrName == NULL) {
-                               LOG_ER("Failed to realloc memory");
-                               goto error;
+                               LOG_ER("%s: Failed to realloc 
memory",__FUNCTION__);
+                               osaf_abort(0);
                        }
                        memcpy(s_get_rdn_attr_name.attrName,
                               attrDescr[i]->attrName,
@@ -213,7 +206,7 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
        }
 
        /* Free memory allocated for attribute descriptions */
-       rc = saImmOmClassDescriptionMemoryFree_2(immOmHandle,
+       rc = saImmOmClassDescriptionMemoryFree_2(ntfimcn_cb.immOmHandle,
                                                 attrDescr);
        if (rc != SA_AIS_OK) {
                LOG_NO("saImmOmClassDescriptionMemoryFree_2() Fail %s",
@@ -221,9 +214,6 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
                goto error;
        }
 
-       /* Release the OM Handle */
-       finalizeImmOmHandle(immOmHandle);
-
 done:
        TRACE_LEAVE();
        return s_get_rdn_attr_name.attrName;
@@ -231,20 +221,9 @@ error:
        /* NOTE: Resources are allocated by this function
         *       saImmOmClassDescriptionMemoryFree_2() must be called before
         *       returning from this function. Not done here because of
-        *       osafassert()
+        *       imcn_exit()
         */
-       LOG_ER("%s Failed", __FUNCTION__);
-       if ( rc == SA_AIS_ERR_NOT_EXIST ) {
-               LOG_NO("osafntfimcnd restarting due to error %s.",
-                       saf_error(rc));
-               _exit(EXIT_FAILURE);
-       }
-       else
-       {
-               // core dump will be generated for all other errors which will 
be used
-               // for further analysis of the error.
-               osafassert(0);
-       }
+       imcn_exit(EXIT_FAILURE);
        return 0; /* Dummy */
 }
 
@@ -936,7 +915,7 @@ done:
 static bool initializeImmOmHandle(SaImmHandleT* immOmHandle) {
        struct timespec timeout_ts;
        struct timespec delay_ts;
-       SaAisErrorT ais_rc;
+       SaAisErrorT ais_rc = SA_AIS_OK;
        bool internal_rc = true;
        SaVersionT imm_version = kImmVersion;
 
@@ -946,7 +925,8 @@ static bool initializeImmOmHandle(SaImmHandleT* 
immOmHandle) {
        while (osaf_is_timeout(&timeout_ts) == false) {
                ais_rc = saImmOmInitialize(immOmHandle,
                        &omCallbacks, &imm_version);
-               if (ais_rc != SA_AIS_ERR_TRY_AGAIN) {
+               if (ais_rc != SA_AIS_ERR_TRY_AGAIN &&
+                       ais_rc != SA_AIS_ERR_TIMEOUT) {
                        break;
                }
                osaf_nanosleep(&delay_ts);
@@ -954,8 +934,8 @@ static bool initializeImmOmHandle(SaImmHandleT* 
immOmHandle) {
        }
 
        if (ais_rc != SA_AIS_OK) {
-               LOG_NO("%s saImmOmInitialize failed %s", __FUNCTION__,
-                      saf_error(ais_rc));
+               LOG_NO("%s saImmOmInitialize failed %s",
+                       __FUNCTION__, saf_error(ais_rc));
                internal_rc = false;
        }
        return internal_rc;
@@ -978,7 +958,7 @@ static void finalizeImmOmHandle(SaImmHandleT immOmHandle) {
        }
 
        if (ais_rc != SA_AIS_OK) {
-               LOG_NO("%s saImmOmInitialize failed %s", __FUNCTION__,
+               LOG_NO("%s saImmOmFinalize failed %s", __FUNCTION__,
                       saf_error(ais_rc));
        }
 }
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to