components/trousers/patches/tspi_rpc_hosttable.c.patch
changeset 777 e2e604cdbd6a
parent 259 520697a05dde
child 5941 db8aa9865e9f
equal deleted inserted replaced
776:e524216b0586 777:e2e604cdbd6a
       
     1 --- src/tspi/rpc/hosttable.c	2010-05-01 19:39:11.000000000 -0700
       
     2 +++ src/tspi/rpc/hosttable.c	2012-03-23 16:21:30.018582000 -0700
       
     3 @@ -22,7 +22,7 @@
       
     4  struct host_table *ht = NULL;
       
     5  
       
     6  TSS_RESULT
       
     7 -host_table_init()
       
     8 +static host_table_init(void)
       
     9  {
       
    10  	ht = calloc(1, sizeof(struct host_table));
       
    11  	if (ht == NULL) {
       
    12 @@ -36,8 +36,7 @@
       
    13  }
       
    14  
       
    15  #ifdef SOLARIS
       
    16 -#pragma init(_init)
       
    17 -void _init(void)
       
    18 +static void my_init(void)
       
    19  #else
       
    20  void __attribute__ ((constructor)) my_init(void)
       
    21  #endif
       
    22 @@ -46,11 +45,14 @@
       
    23  	__tspi_obj_list_init();
       
    24  }
       
    25  
       
    26 -void
       
    27 +static void
       
    28  host_table_final()
       
    29  {
       
    30  	struct host_table_entry *hte, *next = NULL;
       
    31  
       
    32 +	if (ht == NULL) /* no host table to free */
       
    33 +		return;
       
    34 +
       
    35  	MUTEX_LOCK(ht->lock);
       
    36  
       
    37  	for (hte = ht->entries; hte; hte = next) {
       
    38 @@ -70,8 +72,7 @@
       
    39  }
       
    40  
       
    41  #ifdef SOLARIS
       
    42 -#pragma fini(_fini)
       
    43 -void _fini(void)
       
    44 +static void my_fini(void)
       
    45  #else
       
    46  void __attribute__ ((destructor)) my_fini(void)
       
    47  #endif
       
    48 @@ -79,6 +80,11 @@
       
    49  	host_table_final();
       
    50  }
       
    51  
       
    52 +#ifdef SOLARIS
       
    53 +#pragma init(my_init)
       
    54 +#pragma fini(my_fini)
       
    55 +#endif
       
    56 +
       
    57  TSS_RESULT
       
    58  __tspi_add_table_entry(TSS_HCONTEXT tspContext, BYTE *host, int type, struct host_table_entry **ret)
       
    59  {