Hi Minh,

Please find below my comments inline.

Thank you
Srinivas

-----Original Message-----
From: minh chau [mailto:[email protected]] 
Sent: Thursday, September 28, 2017 6:49 AM
To: Srinivas <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/1] ntf: correct return code is returned [#2039]

Hi Srinivas,

ack with minor comments.

Thanks
Minh

On 15/09/17 21:10, Srinivas wrote:
> ---
>   src/ntf/apitest/tet_scOutage_reinitializeHandle.c | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/src/ntf/apitest/tet_scOutage_reinitializeHandle.c 
> b/src/ntf/apitest/tet_scOutage_reinitializeHandle.c
> index 63dfae9..4af22ef 100644
> --- a/src/ntf/apitest/tet_scOutage_reinitializeHandle.c
> +++ b/src/ntf/apitest/tet_scOutage_reinitializeHandle.c
> @@ -100,6 +100,7 @@ static SaNtfObjectCreateDeleteNotificationT 
> myObjCrDelNotification;
>   static SaNtfAttributeChangeNotificationT myAttrChangeNotification;
>   static SaNtfStateChangeNotificationT myStateChangeNotification;
>   static SaNtfSecurityAlarmNotificationT mySecAlarmNotification;
> +static SaAisErrorT global_error_id = SA_AIS_OK;
>   
>   extern int gl_tag_mode;
>   
> @@ -147,7 +148,7 @@ static SaAisErrorT check_errors()
>               errors = 0;
>       glob_errors += errors;
>       if (glob_errors) {
> -             rc = SA_AIS_ERR_FAILED_OPERATION;
> +             rc = global_error_id;
>               fprintf_v(stdout, "num of failed notifications: %d\n",
>                         glob_errors);
>       }
> @@ -156,8 +157,10 @@ static SaAisErrorT check_errors()
>   
>   void saferror(SaAisErrorT rc, SaAisErrorT exp)
>   {
> -     if (rc != exp)
> +     if (rc != exp){
>               glob_errors++;
> +             global_error_id = rc;
> +     }
>   }
>   
>   static void resetCounters()
> @@ -170,6 +173,7 @@ static void resetCounters()
>       ntfRecieved.objectCreateDeleteFilterHandle = 0;
>       ntfRecieved.securityAlarmFilterHandle = 0;
>       ntfRecieved.stateChangeFilterHandle = 0;
> +     global_error_id = SA_AIS_OK;
>   }
>   
>   /**
> @@ -825,10 +829,12 @@ void producer_life_cycle(int test_api)
>                                                    &myAlarmNotification);
>       saferror(rc, SA_AIS_OK);
>   
> -     rc = scoutage_saNtfPtrValAllocate(
> -         &myAlarmNotification.notificationHeader,
> -         myAlarmNotification.notificationHandle);
> -     saferror(rc, SA_AIS_OK);
> +     if (glob_errors == 0) {
> +             rc = scoutage_saNtfPtrValAllocate(
> +             &myAlarmNotification.notificationHeader,
> +             myAlarmNotification.notificationHandle);
> +             saferror(rc, SA_AIS_OK);
> +         }
[Minh]: Do we need this change in producer_life_cycle? I think this patch let 
all api(s) called as currently and only memorize the last error code if any
[Srinivas]: Without this condition, the process was dumping core.
The reason for core dump was scoutage_saNtfAlarmNotificationAllocate() returned 
error and myAlarmNotification was not initialized properly.
Below is the backtrace:
(gdb) where
#0  0x800ad68e in scoutage_saNtfPtrValAllocate ()
#1  0x800ae18d in producer_life_cycle ()
#2  0x800ae509 in test_sc_outage_producer_1 ()
#3  0x800c24a9 in run_test_case ()
#4  0x800c2a28 in test_run ()
#5  0x800912db in main ()

>   
>       /* Create security alarm notification */
>       rc = scoutage_saNtfSecurityAlarmNotificationAllocate(


------------------------------------------------------------------------------
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