Hi Canh,

ACK with following comment( not tested ).

On 9/1/2016 12:06 PM, Canh Truong wrote:
> [AVM] why string changed , what was the errors, reported by cppcheck ?
> [Canh]  No, this is not reported by cppcheck.

Please accommodate this fix description/commit  message ,
it will help to find out which change set fixed this issue

Nex time while seeding such combination fixes send in que  1 of 2 & 2 of 2

-AVM

On 9/1/2016 12:06 PM, Canh Truong wrote:
> Hi  Mahesh,
>
> Please see my comment inline.
>
> Regards,
> Canh.
>
> -----Original Message-----
> From: A V Mahesh [mailto:[email protected]]
> Sent: Thursday, September 01, 2016 10:59 AM
> To: Canh Van Truong; [email protected]; [email protected]
> Cc: [email protected]
> Subject: Re: [PATCH 1 of 1] log: fix errors reported by cppcheck version
> 1.75 [#1985]
>
> Hi Canh Van Truong,
>
> On 8/31/2016 12:04 PM, Canh Van Truong wrote:
>>              sprintf(command, VERIFY_CMD_, appLogPath,
>> -                    "safLgStrCfg=verDefaultLogFileFmt",     tZoneMillP);
>> +                    "safLgStr=verDefaultLogFileFmt",        tZoneMillP);
> [AVM] why string changed , what was the errors, reported by cppcheck ?
> [Canh]  No, this is not reported by cppcheck.
>       In the test case, we created runtime stream, object with command:
> (saflogger -a ...).
>       And RDN to create runtime object is  'safLgStr=' , not is '
> safLgStrCfg='.
>
> On 8/31/2016 12:04 PM, Canh Van Truong wrote:
>>    osaf/services/saf/logsv/lgs/lgs_clm.cc |  2 +-
>>    osaf/services/saf/logsv/lgs/lgs_evt.cc |  3 ++-
>>    tests/logsv/tet_LogOiOps.c             |  4 ++--
>>    tests/logsv/tet_log_longDN.c           |  2 +-
>>    4 files changed, 6 insertions(+), 5 deletions(-)
>>
>>
>> Fix errors, reported by cppcheck:
>>
>> osaf/services/saf/logsv/lgs/lgs_clm.cc:120]: (error) Uninitialized
>> variable: rc
>> osaf/services/saf/logsv/lgs/lgs_evt.cc:892]: (error) Invalid strncmp()
> argument nr 3. A non-boolean value is required.
>> diff --git a/osaf/services/saf/logsv/lgs/lgs_clm.cc
>> b/osaf/services/saf/logsv/lgs/lgs_clm.cc
>> --- a/osaf/services/saf/logsv/lgs/lgs_clm.cc
>> +++ b/osaf/services/saf/logsv/lgs/lgs_clm.cc
>> @@ -93,7 +93,7 @@ static uint32_t lgs_clm_node_find(NODE_I
>>     */
>>    static uint32_t lgs_clm_node_add(NODE_ID clm_node_id) {
>>      TRACE_ENTER();
>> -  uint32_t rc;
>> +  uint32_t rc = NCSCC_RC_SUCCESS;
>>      lgs_clm_node_t *clm_node;
>>    
>>      clm_node = new lgs_clm_node_t();
>> diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.cc
>> b/osaf/services/saf/logsv/lgs/lgs_evt.cc
>> --- a/osaf/services/saf/logsv/lgs/lgs_evt.cc
>> +++ b/osaf/services/saf/logsv/lgs/lgs_evt.cc
>> @@ -799,6 +799,7 @@ SaAisErrorT create_new_app_stream(lgsv_s
>>      SaUint32T logMaxLogrecsize_conf = 0;
>>      SaConstStringT str_name;
>>      int num, err = 0;
>> +  const char *dnPrefix = "safLgStr=";
>>    
>>      TRACE_ENTER();
>>    
>> @@ -873,7 +874,7 @@ SaAisErrorT create_new_app_stream(lgsv_s
>>    
>>      /* Verify that the name seems to be a DN */
>>      str_name = osaf_extended_name_borrow(&open_sync_param->lstr_name);
>> -  if (strncmp("safLgStr=", str_name, sizeof("safLgStr=") != 0)) {
>> +  if (strncmp(dnPrefix, str_name, strlen(dnPrefix)) != 0) {
>>        TRACE("'%s' is not a valid stream name => invalid param", str_name);
>>        rc = SA_AIS_ERR_INVALID_PARAM;
>>        goto done;
>> diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c
>> --- a/tests/logsv/tet_LogOiOps.c
>> +++ b/tests/logsv/tet_LogOiOps.c
>> @@ -2443,7 +2443,7 @@ void verDefaultLogFileFmt(void)
>>      rc = system(command);
>>      if (WEXITSTATUS(rc) == 0) {
>>              /* Send an system log to app stream */
>> -            rc = system("saflogger -a
> safLgStrCfg=verDefaultLogFileFmt");
>> +            rc = system("saflogger -a safLgStr=verDefaultLogFileFmt");
>>              if (WEXITSTATUS(rc)) {
>>                      /* Failed to send log record to app stream */
>>                      fprintf(stderr, "Failed to invoke saflogger -a\n");
> @@ -2457,7
>> +2457,7 @@ void verDefaultLogFileFmt(void)
>>              /* Verify the content of log file if it is reflected with
> right format */
>>              sprintf(appLogPath, "%s/saflogger", log_root_path);
>>              sprintf(command, VERIFY_CMD_, appLogPath,
>> -                    "safLgStrCfg=verDefaultLogFileFmt",     tZoneMillP);
>> +                    "safLgStr=verDefaultLogFileFmt",        tZoneMillP);
>>    
>>              rc = system(command);
>>              if (rc == -1) {
>> diff --git a/tests/logsv/tet_log_longDN.c
>> b/tests/logsv/tet_log_longDN.c
>> --- a/tests/logsv/tet_log_longDN.c
>> +++ b/tests/logsv/tet_log_longDN.c
>> @@ -905,7 +905,7 @@ void longDNIn_AppStreamDN(void)
>>      memset(appStreamDN, 'D', sizeof(appStreamDN) - 1);
>>    
>>      // Perform testing
>> -    sprintf(command, "saflogger -a safLgStrCfg=%s -f longDN
> longDN_test", appStreamDN);
>> +    sprintf(command, "saflogger -a safLgStr=%s -f longDN longDN_test",
>> +appStreamDN);
>>      rc = system(command);
>>      if (WEXITSTATUS(rc) != 0) {
>>              fprintf(stderr, "Failed to perform cmd = %s\n", command);
>


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to