Create copies of set before iteration
authorLukas Prokop <admin@lukas-prokop.at>
Wed, 19 Feb 2014 22:47:38 +0000 (23:47 +0100)
committerLukas Prokop <admin@lukas-prokop.at>
Wed, 19 Feb 2014 22:53:58 +0000 (23:53 +0100)
grml2usb

index 93b1d11..94f73ed 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -170,14 +170,14 @@ def cleanup():
     proc = subprocess.Popen(["sync"])
     proc.wait()
 
     proc = subprocess.Popen(["sync"])
     proc.wait()
 
-    for device in MOUNTED:
+    for device in MOUNTED.copy():
         try:
             unmount(device, "")
             logging.debug('Unmounted %s' % device)
         except RuntimeError:
             logging.debug('RuntimeError while umount %s, ignoring' % device)
 
         try:
             unmount(device, "")
             logging.debug('Unmounted %s' % device)
         except RuntimeError:
             logging.debug('RuntimeError while umount %s, ignoring' % device)
 
-    for tmppath in TMPFILES:
+    for tmppath in TMPFILES.copy():
         try:
             if os.path.isdir(tmppath) and not os.path.islink(tmppath):
                 # symbolic links to directories are ignored
         try:
             if os.path.isdir(tmppath) and not os.path.islink(tmppath):
                 # symbolic links to directories are ignored