[Pcsclite-cvs-commit] Drivers/ccid/src/protocol_t1 protocol_t1.c,1.6,1.7

rousseau@quantz.debian.org rousseau@quantz.debian.org
Wed, 11 Feb 2004 15:36:08 +0100


Update of /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1
In directory quantz:/tmp/cvs-serv11313/protocol_t1

Modified Files:
	protocol_t1.c 
Log Message:
add return code tests in Protocol_T1_Negociate_IFSD()


Index: protocol_t1.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/protocol_t1/protocol_t1.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- protocol_t1.c	11 Feb 2004 10:12:47 -0000	1.6
+++ protocol_t1.c	11 Feb 2004 14:36:05 -0000	1.7
@@ -60,7 +60,7 @@
 Protocol_T1_ReceiveBlock (Protocol_T1 * t1, T1_Block ** block);
 
 /*
- * Exproted funtions definition
+ * Exported funtions definition
  */
 
 int
@@ -68,16 +68,19 @@
 {
 	T1_Block *sblock;
 	BYTE inf[1];
+	int ret;
 
 	inf[0] = ifsd;
 	sblock = T1_Block_NewSBlock(T1_BLOCK_S_IFS_REQ, 1, inf);
 
-	Protocol_T1_SendBlock(t1, sblock);
+	ret = Protocol_T1_SendBlock(t1, sblock);
 	T1_Block_Delete(sblock);
+	if (PROTOCOL_T1_OK != ret)
+		return ret;
 
-	Protocol_T1_ReceiveBlock(t1, &sblock);
-
-	t1 -> ifsd = T1_Block_GetInf(sblock)[0];
+	if (PROTOCOL_T1_OK == Protocol_T1_ReceiveBlock(t1, &sblock))
+		t1 -> ifsd = T1_Block_GetInf(sblock)[0];
+	T1_Block_Delete(sblock);
 
 	return PROTOCOL_T1_OK;
 } /* Protocol_T1_Negociate_IFSD */
@@ -328,8 +331,6 @@
   /* Receive T=1 block */
   if (CCID_Receive(t1->lun, &len, cmd) != IFD_SUCCESS)
     {
-      if (len >= ERROR_OFFSET)
-        ccid_error(cmd[ERROR_OFFSET], __FILE__, __LINE__);	/* bError */
       ret = PROTOCOL_T1_ICC_ERROR;
       (*block) = NULL;
     }