Changeset 2832
- Timestamp:
- 02/05/06 19:35:55 (3 years ago)
- Location:
- trunk/src
- Files:
-
- 7 modified
-
libopensc/card.c (modified) (1 diff)
-
libopensc/ctbcs.c (modified) (2 diffs)
-
libopensc/ctx.c (modified) (1 diff)
-
libopensc/internal.h (modified) (1 diff)
-
libopensc/opensc.h (modified) (1 diff)
-
libopensc/sc.c (modified) (1 diff)
-
pkcs11/pkcs11-global.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libopensc/card.c
r2829 r2832 88 88 if (card->algorithms != NULL) 89 89 free(card->algorithms); 90 if (card->mutex != NULL) 91 sc_mutex_destroy(card->ctx, card->mutex); 90 if (card->mutex != NULL) { 91 int r = sc_mutex_destroy(card->ctx, card->mutex); 92 if (r != SC_SUCCESS) 93 sc_error(card->ctx, "unable to destroy mutex\n"); 94 } 92 95 sc_mem_clear(card, sizeof(*card)); 93 96 free(card); -
trunk/src/libopensc/ctbcs.c
r2829 r2832 159 159 sc_apdu_t apdu; 160 160 struct sc_card_operations ops; 161 int r ;161 int r, s; 162 162 163 163 switch (data->cmd) { … … 186 186 187 187 r = sc_transmit_apdu(card, &apdu); 188 sc_mutex_destroy(reader->ctx, card->mutex); 188 s = sc_mutex_destroy(reader->ctx, card->mutex); 189 if (s != SC_SUCCESS) { 190 sc_error(reader->ctx, "unable to destroy mutex\n"); 191 return s; 192 } 189 193 SC_TEST_RET(card->ctx, r, "APDU transmit failed"); 190 194 -
trunk/src/libopensc/ctx.c
r2831 r2832 747 747 _sc_free_atr(ctx, drv); 748 748 } 749 if (ctx->preferred_language != NULL) 750 free(ctx->preferred_language); 751 if (ctx->mutex != NULL) { 752 int r = sc_mutex_destroy(ctx, ctx->mutex); 753 if (r != SC_SUCCESS) { 754 sc_error(ctx, "unable to destroy mutex\n"); 755 return r; 756 } 757 } 758 if (ctx->conf != NULL) 759 scconf_free(ctx->conf); 749 760 if (ctx->debug_file && ctx->debug_file != stdout) 750 761 fclose(ctx->debug_file); 751 762 if (ctx->error_file && ctx->error_file != stderr) 752 763 fclose(ctx->error_file); 753 if (ctx->preferred_language != NULL)754 free(ctx->preferred_language);755 if (ctx->conf != NULL)756 scconf_free(ctx->conf);757 if (ctx->mutex != NULL)758 sc_mutex_destroy(ctx, ctx->mutex);759 764 if (ctx->app_name != NULL) 760 765 free(ctx->app_name); -
trunk/src/libopensc/internal.h
r2831 r2832 149 149 * @param ctx sc_context_t object with the thread context 150 150 * @param mutex mutex object to be destroyed 151 * @return SC_SUCCESS on success and an error code otherwise 151 152 */ 152 voidsc_mutex_destroy(const sc_context_t *ctx, void *mutex);153 int sc_mutex_destroy(const sc_context_t *ctx, void *mutex); 153 154 /** 154 155 * Returns a unique id for every thread. -
trunk/src/libopensc/opensc.h
r2831 r2832 630 630 int (*unlock_mutex)(void *); 631 631 /** destroys a mutex object */ 632 void(*destroy_mutex)(void *);632 int (*destroy_mutex)(void *); 633 633 /** returns unique identifier for the thread (can be NULL) */ 634 634 unsigned long (*thread_id)(void); -
trunk/src/libopensc/sc.c
r2829 r2832 706 706 } 707 707 708 void sc_mutex_destroy(const sc_context_t *ctx, void *mutex) 709 { 710 if (ctx == NULL || ctx->thread_ctx == NULL || 711 ctx->thread_ctx->destroy_mutex == NULL) 712 return; 713 ctx->thread_ctx->destroy_mutex(mutex); 708 int sc_mutex_destroy(const sc_context_t *ctx, void *mutex) 709 { 710 if (ctx == NULL) 711 return SC_ERROR_INVALID_ARGUMENTS; 712 if (ctx->thread_ctx != NULL && ctx->thread_ctx->destroy_mutex != NULL) 713 return ctx->thread_ctx->destroy_mutex(mutex); 714 else 715 return SC_SUCCESS; 714 716 } 715 717 -
trunk/src/pkcs11/pkcs11-global.c
r2829 r2832 152 152 } 153 153 154 static voidsc_destroy_mutex(void *m)154 static int sc_destroy_mutex(void *m) 155 155 { 156 156 if (_locking == NULL) 157 return; 158 _locking->DestroyMutex(m); 157 return SC_SUCCESS; 158 if (_locking->DestroyMutex(m) == CKR_OK) 159 return SC_SUCCESS; 160 else 161 return SC_ERROR_INTERNAL; 159 162 } 160 163
