Changeset 510


Ignore:
Timestamp:
Sep 20, 2016, 7:59:21 PM (8 years ago)
Author:
katerina
Message:

Fix for ticket #403 (case sensitivity of severity/class).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_error.c

    r488 r510  
    244244{
    245245  char * p;
     246  char * q;
    246247  int    num = 0;
    247248  unsigned int    i;
     
    289290    if (p == NULL)
    290291      break;
     292
     293    q = p; while (*q != '\0') { *q = toupper( (int) *q); ++q; }
    291294
    292295    for (i = 0; i < SH_CLA_MAX; ++i)
     
    495498  int i;
    496499  int level = (-1);
     500  char * tmp;
     501  char * q;
    497502 
    498503  SL_ENTER(_("sh_error_convert_level"));
     
    501506     SL_RETURN( -1, _("sh_error_convert_level"));
    502507
     508  q = sh_util_strdup(str_s);
     509  tmp = q; while (*tmp != '\0') { *tmp = tolower( (int) *tmp); ++tmp; }
     510 
    503511  for (i = 0; i < SH_EEF_MAX; ++i)
    504512    {
    505       if (0 == sl_strncmp(str_s, _(eef_tab[i].str),
     513      if (0 == sl_strncmp(q, _(eef_tab[i].str),
    506514                          sl_strlen(eef_tab[i].str)))
    507515        {
     
    511519    }
    512520
     521  SH_FREE(q);
    513522  SL_RETURN( level, _("sh_error_convert_level"));
    514523}
     
    554563
    555564  int  old_facility;
    556   const char * str_s = str_in;
     565  char * str_s;
     566  char * str_orig;
     567  char * tmp;
    557568
    558569  SL_ENTER(_("sh_error_set_level"));
    559570
     571  str_s = sh_util_strdup(str_in);
     572  str_orig = str_s;
     573 
     574  tmp = str_s; while (*tmp != '\0') { *tmp = tolower( (int) *tmp); ++tmp; }
     575 
    560576  if (IsInitialized == BAD)
    561577    (void) sh_error_init();
     
    650666  if (!str_s)
    651667    {
     668      if (str_orig) SH_FREE(str_orig);
    652669      SL_RETURN ((-1), _("sh_error_set_level"));
    653670    }
     
    675692      sh_error_handle ((-1), FIL__, __LINE__, EINVAL, MSG_EINVALS,
    676693                       _("priority"), str_in);
     694      SH_FREE(str_orig);
    677695      SL_RETURN (-1, _("sh_error_set_level"));
    678696    }
    679697  compute_flag_err_debug();
    680698  compute_flag_err_info();
     699  SH_FREE(str_orig);
    681700  SL_RETURN (0, _("sh_error_set_level"));
    682701}
Note: See TracChangeset for help on using the changeset viewer.