Print this page
10100 Illumos is confused about calloc() arguments

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/librtld_db/common/rtld_db.c
          +++ new/usr/src/cmd/sgs/librtld_db/common/rtld_db.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       26 +/*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
  27   29  
  28      -
  29   30  #include        <stdlib.h>
  30   31  #include        <stdio.h>
  31   32  #include        <string.h>
  32   33  #include        <proc_service.h>
  33   34  #include        <link.h>
  34   35  #include        <rtld_db.h>
  35   36  #include        <rtld.h>
  36   37  #include        <_rtld_db.h>
  37   38  #include        <msg.h>
  38   39  #include        <sys/param.h>
↓ open down ↓ 116 lines elided ↑ open up ↑
 155  156          return (err);
 156  157  }
 157  158  
 158  159  
 159  160  rd_agent_t *
 160  161  rd_new(struct ps_prochandle *php)
 161  162  {
 162  163          rd_agent_t      *rap;
 163  164  
 164  165          LOG(ps_plog(MSG_ORIG(MSG_DB_RDNEW), php));
 165      -        if ((rap = (rd_agent_t *)calloc(sizeof (rd_agent_t), 1)) == NULL)
      166 +        if ((rap = (rd_agent_t *)calloc(1, sizeof (rd_agent_t))) == NULL)
 166  167                  return (0);
 167  168  
 168  169          rap->rd_psp = php;
 169  170          (void) mutex_init(&rap->rd_mutex, USYNC_THREAD, 0);
 170  171          if (rd_reset(rap) != RD_OK) {
 171  172                  if (rap->rd_helper.rh_dlhandle != NULL) {
 172  173                          rap->rd_helper.rh_ops->rho_fini(rap->rd_helper.rh_data);
 173  174                          (void) dlclose(rap->rd_helper.rh_dlhandle);
 174  175                  }
 175  176                  free(rap);
↓ open down ↓ 197 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX