]> www.vanbest.org Git - sasc-ng.git/commitdiff
smartcards: fix div/zero for clock=0 from config
authorleslie <unknown>
Wed, 1 Apr 2009 10:54:08 +0000 (18:54 +0800)
committerleslie <unknown>
Wed, 1 Apr 2009 10:54:08 +0000 (18:54 +0800)
smartcard.c

index aa4c36bb313a06ecefe740ab137f15a2f49fc2de..448fc367a00abf66854c31f27ab3d5e2d2b3434f 100644 (file)
@@ -683,6 +683,7 @@ bool cSmartCardSlotSerial::DeviceOpen(const char *cfg)
 {
   int invCD=0;
   if(sscanf(cfg,"%255[^:]:%d:%d:%d",devName,&invCD,&invRST,&clock)>=3) {
+    if(clock<=0) clock=ISO_FREQ;
     statInv=invCD ? TIOCM_CAR:0;
     PRINTF(L_CORE_SERIAL,"%s: open serial port",devName);
     fd=open(devName,O_RDWR|O_NONBLOCK|O_NOCTTY);
@@ -979,7 +980,7 @@ cSmartCardSlotSRPlus::cSmartCardSlotSRPlus(void)
 bool cSmartCardSlotSRPlus::DeviceOpen(const char *cfg)
 {
   if(sscanf(cfg,"%255[^:]:%d",devName,&clock)>=1) {
-    if(clock==0) clock=ISO_FREQ;
+    if(clock<=0) clock=ISO_FREQ;
     PRINTF(L_CORE_SERIAL,"%s: open serial port",devName);
     fd=open(devName,O_RDWR|O_NONBLOCK|O_NOCTTY);
     if(fd>=0) {