Print this page
5910 libnisdb won't build with modern GCC

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libnisdb/db_mindex3.cc
          +++ new/usr/src/lib/libnisdb/db_mindex3.cc
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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 + * Copyright 2015 Gary Mills
  22   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   24   * Use is subject to license terms.
       25 + *
       26 + * Copyright 2015 RackTop Systems.
  24   27   */
  25   28  
  26   29  #include <sys/types.h>
  27   30  #include <time.h>
  28   31  #include <sys/time.h>
  29   32  #include <lber.h>
  30   33  #include <ldap.h>
  31   34  #include <signal.h>
  32   35  #include <pthread.h>
  33   36  #include "db_headers.h"
↓ open down ↓ 173 lines elided ↑ open up ↑
 207  210  #else
 208  211                  (void) pthread_attr_setdetachstate(&attr,
 209  212                                                  PTHREAD_CREATE_DETACHED);
 210  213  #endif  /* FORCE_SYNCHRONOUS */
 211  214                  stat = pthread_create(&tid, &attr, entriesFromLDAPthread, arg);
 212  215                  if (stat != 0) {
 213  216                          (void) mutex_unlock(&table->mapping.enumLock);
 214  217                          logmsg(MSG_NOTIMECHECK, LOG_WARNING,
 215  218                          "%s: Error %d creating new thread; using current one",
 216  219                                  myself, stat);
 217      -                        stat = (int)entriesFromLDAPthread(arg);
      220 +                        stat = entriesFromLDAPreal(arg);
 218  221                          return (stat);
 219  222                  }
 220  223  
 221  224                  table->mapping.enumTid = tid;
 222  225                  table->mapping.enumStat = -1;
 223  226  
 224  227                  /*
 225  228                   * We're now returning to the caller, who will get data
 226  229                   * from:
 227  230                   *
↓ open down ↓ 22 lines elided ↑ open up ↑
 250  253                          } else {
 251  254                                  logmsg(MSG_NOTIMECHECK, LOG_ERR,
 252  255                                          "%s: pthread_join(%d) => %d",
 253  256                                          myself, tid, stat);
 254  257                                  stat = LDAP_OPERATIONS_ERROR;
 255  258                          }
 256  259                  }
 257  260  #endif  /* FORCE_SYNCHRONOUS */
 258  261          } else {
 259  262                  (void) mutex_unlock(&table->mapping.enumLock);
 260      -                stat = (int)entriesFromLDAPthread(arg);
      263 +                stat = entriesFromLDAPreal(arg);
 261  264          }
 262  265  
 263  266          return (stat);
 264  267  }
 265  268  
 266  269  extern "C" {
 267  270  
 268  271  /*
 269  272   * We use this 'extern "C"' function in order to make sure that
 270  273   * pthread_create() doesn't have any problems trying to invoke a
 271  274   * C++ function.
 272  275   */
 273  276  static void *
 274  277  entriesFromLDAPthread(void *voidarg) {
 275  278          __entries_from_ldap_arg_t       *arg;
 276      -        int                             stat;
 277  279          db                              *dbase;
 278  280          db_table_desc                   *tbl = 0;
 279  281          char                            *tableName;
 280  282  
 281  283          arg = (__entries_from_ldap_arg_t *)voidarg;
 282  284  
 283  285          /* Lock to prevent removal */
 284  286          (void) __nis_lock_db_table(arg->tableName, 1, 0,
 285  287                                          "entriesFromLDAPthread");
 286  288  
↓ open down ↓ 17 lines elided ↑ open up ↑
 304  306  #ifdef  NISDB_LDAP_DEBUG
 305  307                  logmsg(MSG_NOTIMECHECK, LOG_WARNING,
 306  308                          "entriesFromLDAPthread: %s -> %s -> 0x%x (0x%x)",
 307  309                          NIL(arg->tableName), NIL(tableName),
 308  310                          arg->mindex, oldMindex);
 309  311  #endif  /* NISDB_LDAP_DEBUG */
 310  312                  sfree(tableName);
 311  313                  tableName = 0;
 312  314          }
 313  315  
 314      -        stat = entriesFromLDAPreal(arg);
      316 +        (void) entriesFromLDAPreal(arg);
 315  317  
 316  318          (void) __nis_ulock_db_table(arg->tableName, 1, 0,
 317  319                                          "entriesFromLDAPthread");
 318  320  
 319  321          freeQuery(arg->q);
 320  322          if (arg->dirObj != 0)
 321  323                  nis_destroy_object(arg->dirObj);
 322  324          sfree(arg);
 323      -        return ((void *)stat);
      325 +        return (NULL);
 324  326  }
 325  327  
 326  328  }
 327  329  
 328  330  int
 329  331  entriesFromLDAPreal(__entries_from_ldap_arg_t *arg) {
 330  332          db_mindex                       *mindex;
 331  333          db_table                        *table;
 332  334          __nis_table_mapping_t           *t;
 333  335          db_query                        *q, *qin;
↓ open down ↓ 604 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX