From 5bc76098a53192a50d5342c4fe3d587ae73b202f Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Sat, 29 Jun 2019 10:01:21 +0200 Subject: [PATCH] build_library: break the attempt loop when losetup succeeds We need to break the attempt loop when losetup succeeds. Also we should not use finally, which is called also for success. --- build_library/disk_util | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_library/disk_util b/build_library/disk_util index 699a173317..aa7743a5c9 100755 --- a/build_library/disk_util +++ b/build_library/disk_util @@ -444,11 +444,11 @@ def PartitionLoop(options, partition): '--sizelimit', str(partition['bytes']), '--find', '--show', options.disk_image]) loop_dev = loop_dev.strip() + break except: + Sudo(['losetup', '--detach', loop_dev]) attempts += 1 time.sleep(1) - finally: - Sudo(['losetup', '--detach', loop_dev]) yield loop_dev