Print this page
Thread safety fixes.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/lmonetary.c
          +++ new/usr/src/lib/libc/port/locale/lmonetary.c
↓ open down ↓ 65 lines elided ↑ open up ↑
  66   66          numempty,       /* int_n_cs_precedes */
  67   67          numempty,       /* int_p_sep_by_space */
  68   68          numempty,       /* int_n_sep_by_space */
  69   69          numempty,       /* int_p_sign_posn */
  70   70          numempty,       /* int_n_sign_posn */
  71   71          empty           /* crncystr */
  72   72  };
  73   73  
  74   74  struct locdata __posix_monetary_locdata = {
  75   75          .l_lname = "C",
  76      -        .l_refcnt = (uint32_t)-1,
  77   76          .l_data = { &lc_monetary_posix }
  78   77  };
  79   78  
  80   79  static char
  81   80  cnv(const char *str)
  82   81  {
  83   82          int i = strtol(str, NULL, 10);
  84   83  
  85   84          if (i == -1)
  86   85                  i = CHAR_MAX;
↓ open down ↓ 11 lines elided ↑ open up ↑
  98   97          if ((ldata = __locdata_alloc(name, sizeof (*lmon))) == NULL) {
  99   98                  return (NULL);
 100   99          }
 101  100          lmon = ldata->l_data[0];
 102  101  
 103  102          ret = __part_load_locale(name, (char **)&ldata->l_data[1],
 104  103              "LC_MONETARY", LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
 105  104              (const char **)lmon);
 106  105  
 107  106          if (ret != _LDP_LOADED) {
 108      -                __locdata_release(ldata);
      107 +                __locdata_free(ldata);
 109  108                  errno = EINVAL;
 110  109                  return (NULL);
 111  110          }
 112  111  
 113  112          /* special storage for currency string */
 114  113          clen = strlen(lmon->currency_symbol) + 2;
 115  114          ldata->l_data[2] = malloc(clen);
 116  115          lmon->crncystr = ldata->l_data[2];
 117  116          lmon->crncystr[0] = '\0';
 118  117  
↓ open down ↓ 62 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX