[Pcsclite-cvs-commit] r4523 - /trunk/PCSC/src/readerfactory.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Wed Oct 28 14:35:48 UTC 2009
Author: rousseau
Date: Wed Oct 28 14:35:42 2009
New Revision: 4523
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4523
Log:
use return() instead of exit() if DYN_GetAddress() fails
Modified:
trunk/PCSC/src/readerfactory.c
Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4523&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Wed Oct 28 14:35:42 2009
@@ -692,7 +692,7 @@
/* Neither version of the IFD Handler was found - exit */
Log1(PCSC_LOG_CRITICAL, "IFDHandler functions missing");
- exit(1);
+ return SCARD_F_UNKNOWN_ERROR;
} else if (rv1 == SCARD_S_SUCCESS)
{
/* Ifd Handler 1.0 found */
@@ -716,7 +716,8 @@
#define GET_ADDRESS_OPTIONALv1(field, function, code) \
{ \
void *f1 = NULL; \
- if (SCARD_S_SUCCESS != DYN_GetAddress(rContext->vHandle, &f1, "IFD_" #function)) \
+ DWORD rv = DYN_GetAddress(rContext->vHandle, &f1, "IFD_" #function); \
+ if (SCARD_S_SUCCESS != rv) \
{ \
code \
} \
@@ -726,7 +727,7 @@
#define GET_ADDRESSv1(field, function) \
GET_ADDRESS_OPTIONALv1(field, function, \
Log1(PCSC_LOG_CRITICAL, "IFDHandler functions missing: " #function ); \
- exit(1); )
+ return(rv); )
(void)DYN_GetAddress(rContext->vHandle, &f, "IO_Create_Channel");
rContext->psFunctions.psFunctions_v1.pvfCreateChannel = f;
@@ -735,7 +736,7 @@
"IO_Close_Channel"))
{
Log1(PCSC_LOG_CRITICAL, "IFDHandler functions missing");
- exit(1);
+ return SCARD_F_UNKNOWN_ERROR;
}
rContext->psFunctions.psFunctions_v1.pvfCloseChannel = f;
@@ -753,7 +754,8 @@
#define GET_ADDRESS_OPTIONALv2(s, code) \
{ \
void *f1 = NULL; \
- if (SCARD_S_SUCCESS != DYN_GetAddress(rContext->vHandle, &f1, "IFDH" #s)) \
+ DWORD rv = DYN_GetAddress(rContext->vHandle, &f1, "IFDH" #s); \
+ if (SCARD_S_SUCCESS != rv) \
{ \
code \
} \
@@ -763,7 +765,7 @@
#define GET_ADDRESSv2(s) \
GET_ADDRESS_OPTIONALv2(s, \
Log1(PCSC_LOG_CRITICAL, "IFDHandler functions missing: " #s ); \
- exit(1); )
+ return(rv); )
Log1(PCSC_LOG_INFO, "Loading IFD Handler 2.0");
@@ -784,7 +786,8 @@
#define GET_ADDRESS_OPTIONALv3(s, code) \
{ \
void *f1 = NULL; \
- if (SCARD_S_SUCCESS != DYN_GetAddress(rContext->vHandle, &f1, "IFDH" #s)) \
+ DWORD rv = DYN_GetAddress(rContext->vHandle, &f1, "IFDH" #s); \
+ if (SCARD_S_SUCCESS != rv) \
{ \
code \
} \
@@ -794,7 +797,7 @@
#define GET_ADDRESSv3(s) \
GET_ADDRESS_OPTIONALv3(s, \
Log1(PCSC_LOG_CRITICAL, "IFDHandler functions missing: " #s ); \
- exit(1); )
+ return(rv); )
Log1(PCSC_LOG_INFO, "Loading IFD Handler 3.0");
@@ -814,7 +817,7 @@
{
/* Who knows what could have happenned for it to get here. */
Log1(PCSC_LOG_CRITICAL, "IFD Handler not 1.0/2.0 or 3.0");
- exit(1);
+ return SCARD_F_UNKNOWN_ERROR;
}
return SCARD_S_SUCCESS;
More information about the Pcsclite-cvs-commit
mailing list