[Pcsclite-cvs-commit] r2718 - /trunk/PCSC/src/configfile.l
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jan 3 14:33:15 UTC 2008
Author: rousseau
Date: Thu Jan 3 14:33:14 2008
New Revision: 2718
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=2718
Log:
improve detection of wrong format in reader.conf file
Modified:
trunk/PCSC/src/configfile.l
Modified: trunk/PCSC/src/configfile.l
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/configfile.l?rev=2718&op=diff
==============================================================================
--- trunk/PCSC/src/configfile.l (original)
+++ trunk/PCSC/src/configfile.l Thu Jan 3 14:33:14 2008
@@ -20,6 +20,7 @@
int evaluatetoken(char *pcToken);
static int iLinenumber;
+static int iOldLinenumber;
static char *pcPrevious;
static char *pcCurrent;
static char *pcFriendlyname;
@@ -69,9 +70,19 @@
if (pcPrevious == NULL)
{ /* This is the key */
pcPrevious = strdup(pcToken);
+ iOldLinenumber = iLinenumber;
}
else
{
+ /* first and second tokens are not on the same line */
+ if (iOldLinenumber != iLinenumber)
+ {
+ tok_error(pcPrevious);
+ pcPrevious = strdup(pcToken);
+ iOldLinenumber = iLinenumber;
+ return 1;
+ }
+
pcCurrent = pcToken;
if (strcmp(pcPrevious, "FRIENDLYNAME") == 0)
{
@@ -155,6 +166,8 @@
else
{
tok_error(pcPrevious);
+ free(pcPrevious);
+ pcPrevious = NULL;
return 1;
}
@@ -198,8 +211,7 @@
void tok_error(char *token_error)
{
- Log2(PCSC_LOG_ERROR, "tok_error: invalid value in reader.conf: %s",
- token_error);
+ Log3(PCSC_LOG_ERROR, "tok_error: invalid value line %d in " PCSCLITE_READER_CONFIG ": %s", iOldLinenumber, token_error);
badError = 1;
}
@@ -218,6 +230,7 @@
/* (re)start with a clean state */
iLinenumber = 1;
+ iOldLinenumber = -1;
reader_list = NULL;
reader_list_size = 0;
pcFriendlyname = NULL;
More information about the Pcsclite-cvs-commit
mailing list