[Pcsclite-cvs-commit] PCSC/src configfile.l,1.5,1.6
sauveron-guest@quantz.debian.org
sauveron-guest@quantz.debian.org
Wed, 14 Jan 2004 02:46:49 +0100
Update of /cvsroot/pcsclite/PCSC/src
In directory quantz:/tmp/cvs-serv4557/src
Modified Files:
configfile.l
Log Message:
Check that DEVICENAME and LIBPATH exist and of an error occurs during the parsing the reader is not added.
Index: configfile.l
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/configfile.l,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- configfile.l 13 Jan 2004 20:16:43 -0000 1.5
+++ configfile.l 14 Jan 2004 01:46:46 -0000 1.6
@@ -50,7 +50,7 @@
DWORD dwChannelId = 0;
int p = 0;
int n = 0;
-
+
if ( pcPrevious == 0 ) { /* This is the key */
pcPrevious = strdup( pcToken );
} else {
@@ -69,13 +69,23 @@
}
} else if ( strcmp( pcPrevious, "DEVICENAME" ) == 0 ) {
if ( pcDevicename == 0 ) {
+ struct stat fStatBuf;
pcDevicename = strdup( pcCurrent );
+ if (SYS_Stat(pcDevicename, &fStatBuf) != 0) {
+ DebugLogB("The device %s doesn't exist", pcDevicename);
+ badError = 1;
+ }
} else {
tok_error( pcPrevious ); return 1;
}
} else if ( strcmp( pcPrevious, "LIBPATH" ) == 0 ) {
if ( pcLibpath == 0 ) {
+ struct stat fStatBuf;
pcLibpath = strdup( pcCurrent );
+ if (SYS_Stat(pcLibpath, &fStatBuf) != 0) {
+ DebugLogB("The library %s doesn't exist", pcLibpath);
+ badError = 1;
+ }
} else {
tok_error( pcPrevious ); return 1;
}
@@ -93,10 +103,11 @@
}
if ( pcFriendlyname != 0 && pcDevicename != 0 &&
- pcLibpath != 0 && pcChannelid != 0 ) {
+ pcLibpath != 0 && pcChannelid != 0 &&
+ badError != 1) {
dwChannelId = strtoul( pcChannelid, 0, 16 );
- RFAddReader( pcFriendlyname, dwChannelId, pcLibpath );
+ RFAddReader( pcFriendlyname, dwChannelId, pcLibpath, pcDevicename );
free( pcFriendlyname ); free( pcDevicename );
free( pcLibpath); free( pcChannelid );