Author: dmeyer
Date: Sun Oct 15 17:41:37 2006
New Revision: 1921

Modified:
   trunk/beacon/src/hwmon/cdrom.py

Log:
bugfix?

Modified: trunk/beacon/src/hwmon/cdrom.py
==============================================================================
--- trunk/beacon/src/hwmon/cdrom.py     (original)
+++ trunk/beacon/src/hwmon/cdrom.py     Sun Oct 15 17:41:37 2006
@@ -61,12 +61,13 @@
             s = ioctl(fd, CDIOCEJECT, 0)
         else:
             s = ioctl(fd, CDROMEJECT, 0)
-    except Exception, e:
+    except (OSError, IOError), e:
         log.exception('eject error')
+        return
     try:
         # close the fd to the drive
         os.close(fd)
-    except:
+    except (OSError, IOError), e:
         log.exception('close fd')
 
         
@@ -149,6 +150,10 @@
         # Check drive status
         try:
             fd = os.open(self.device, os.O_RDONLY | os.O_NONBLOCK)
+        except (OSError, IOError), e:
+            return
+
+        try:
             if os.uname()[0] == 'FreeBSD':
                 data = array.array('c', '\000'*4096)
                 (address, length) = data.buffer_info()
@@ -159,13 +164,8 @@
             else:
                 CDSL_CURRENT = ( (int ) ( ~ 0 >> 1 ) )
                 s = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)
-        except Exception, e:
-            # maybe we need to close the fd if ioctl fails, maybe
-            # open fails and there is no fd
-            try:
-                os.close(fd)
-            except (OSError, IOError):
-                pass
+        except (OSError, IOError), e:
+            os.close(fd)
             return
 
         # close fd

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to