osaf/tools/safimm/immcfg/imm_cfg.c |  69 +++++++++++++++++++------------------
 1 files changed, 36 insertions(+), 33 deletions(-)


Add possibility to write error strings for all error codes if they exist.

diff --git a/osaf/tools/safimm/immcfg/imm_cfg.c 
b/osaf/tools/safimm/immcfg/imm_cfg.c
--- a/osaf/tools/safimm/immcfg/imm_cfg.c
+++ b/osaf/tools/safimm/immcfg/imm_cfg.c
@@ -477,18 +477,19 @@ int object_create(const SaNameT **object
                        fprintf(stderr, "error - saImmOmCcbObjectCreate_2 
FAILED with %s\n",
                                saf_error(error));
 
-                       if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) {
-                               fprintf(stderr, "Missing: implementer, or 
object, or attribute "
-                                       "(see: immcfg -h under '--unsafe')\n");
+                       SaAisErrorT rc2 = saImmOmCcbGetErrorStrings(ccbHandle, 
&errStrings);
+                       if(errStrings) {
+                               int ix = 0;
+                               while(errStrings[ix]) {
+                                       fprintf(stderr, "OI reports: %s\n", 
errStrings[ix]);
+                                       ++ix;
+                               }
                        } else {
-                               SaAisErrorT rc2 = 
saImmOmCcbGetErrorStrings(ccbHandle, &errStrings);
-                               if(errStrings) {
-                                       int ix = 0;
-                                       while(errStrings[ix]) {
-                                               fprintf(stderr, "OI reports: 
%s\n", errStrings[ix]);
-                                               ++ix;
-                                       }
-                               } else if(rc2 != SA_AIS_OK) {
+                               if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) 
{
+                                       fprintf(stderr, "Missing: implementer, 
or object, or attribute "
+                                               "(see: immcfg -h under 
'--unsafe')\n");
+                               }
+                               if(rc2 != SA_AIS_OK) {
                                        fprintf(stderr, 
"saImmOmCcbGetErrorStrings failed: %u\n", rc2);
                                }
                        }
@@ -581,18 +582,19 @@ int object_modify(const SaNameT **object
                        (const SaImmAttrModificationT_2 **)attrMods)) != 
SA_AIS_OK) {
                        fprintf(stderr, "error - saImmOmCcbObjectModify_2 
FAILED: %s\n", saf_error(error));
 
-                       if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) {
-                               fprintf(stderr, "Missing: implementer, or 
object, or attribute "
-                                       "(see: immcfg -h under '--unsafe')\n");
+                       SaAisErrorT rc2 = saImmOmCcbGetErrorStrings(ccbHandle, 
&errStrings);
+                       if(errStrings) {
+                               int ix = 0;
+                               while(errStrings[ix]) {
+                                       fprintf(stderr, "OI reports: %s\n", 
errStrings[ix]);
+                                       ++ix;
+                               }
                        } else {
-                               SaAisErrorT rc2 = 
saImmOmCcbGetErrorStrings(ccbHandle, &errStrings);
-                               if(errStrings) {
-                                       int ix = 0;
-                                       while(errStrings[ix]) {
-                                               fprintf(stderr, "OI reports: 
%s\n", errStrings[ix]);
-                                               ++ix;
-                                       }
-                               } else if(rc2 != SA_AIS_OK) {
+                               if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) 
{
+                                       fprintf(stderr, "Missing: implementer, 
or object, or attribute "
+                                               "(see: immcfg -h under 
'--unsafe')\n");
+                               }
+                               if(rc2 != SA_AIS_OK) {
                                        fprintf(stderr, 
"saImmOmCcbGetErrorStrings failed: %u\n", rc2);
                                }
                        }
@@ -652,18 +654,19 @@ int object_delete(const SaNameT **object
                        fprintf(stderr, "error - saImmOmCcbObjectDelete for 
'%s' FAILED: %s\n",
                                objectNames[i]->value, saf_error(error));
 
-                       if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) {
-                               fprintf(stderr, "Missing: implementer, or 
object, or attribute "
-                                       "(see: immcfg -h under '--unsafe')\n");
+                       SaAisErrorT rc2 = saImmOmCcbGetErrorStrings(ccbHandle, 
&errStrings);
+                       if(errStrings) {
+                               int ix = 0;
+                               while(errStrings[ix]) {
+                                       fprintf(stderr, "OI reports: %s\n", 
errStrings[ix]);
+                                       ++ix;
+                               }
                        } else {
-                               SaAisErrorT rc2 = 
saImmOmCcbGetErrorStrings(ccbHandle, &errStrings);
-                               if(errStrings) {
-                                       int ix = 0;
-                                       while(errStrings[ix]) {
-                                               fprintf(stderr, "OI reports: 
%s\n", errStrings[ix]);
-                                               ++ix;
-                                       }
-                               } else if(rc2 != SA_AIS_OK) {
+                               if((error == SA_AIS_ERR_NOT_EXIST) && ccb_safe) 
{
+                                       fprintf(stderr, "Missing: implementer, 
or object, or attribute "
+                                               "(see: immcfg -h under 
'--unsafe')\n");
+                               }
+                               if(rc2 != SA_AIS_OK) {
                                        fprintf(stderr, 
"saImmOmCcbGetErrorStrings failed: %u\n", rc2);
                                }
                        }

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to