Hi,
I guess there are 3 possibilities for infinite loops.
Attached patch fixes this and adjusts loop threshold
to given comments..

-- 
Stefan Lucke
-------------- next part --------------
Index: backend/genesys_gl841.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/genesys_gl841.c,v
retrieving revision 1.19
diff -U 3 -r1.19 genesys_gl841.c
--- backend/genesys_gl841.c     3 Feb 2008 10:34:20 -0000       1.19
+++ backend/genesys_gl841.c     6 Feb 2008 18:29:28 -0000
@@ -3434,7 +3438,7 @@
       return status;
     }
 
-  while (loop < 3)             /* do not wait longer then 30 seconds */
+  while (loop < 300)           /* do not wait longer then 30 seconds */
   {
       status = sanei_genesys_get_status (dev, &val);
       if (status != SANE_STATUS_GOOD)
@@ -3452,6 +3456,7 @@
          return SANE_STATUS_GOOD;
       }
       usleep (100000); /* sleep 100 ms */
+      ++loop;
   }
 
   /* when we come here then the scanner needed too much time for this, so we 
better stop the motor */
@@ -3579,7 +3584,7 @@
     {
       int loop = 0;
 
-      while (loop < 3)         /* do not wait longer then 30 seconds */
+      while (loop < 300)               /* do not wait longer then 30 seconds */
        {
          status = sanei_genesys_get_status (dev, &val);
          if (status != SANE_STATUS_GOOD)
@@ -3598,6 +3603,7 @@
              return SANE_STATUS_GOOD;
            }
          usleep (100000);      /* sleep 100 ms */
+         ++loop;
        }
 
       /* when we come here then the scanner needed too much time for this, so 
we better stop the motor */
@@ -3729,6 +3735,7 @@
                }
            }
          usleep (100000);
+         ++loop;
        }
     } else {
        DBG (DBG_info,

Reply via email to