From: Gui Chen Date: Fri, 17 May 2013 06:00:07 +0000 (-0400) Subject: fix empty value in max built-in X-Git-Tag: 0.19~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d76282e8f2c33f345eab62388e3b6ffd931982c;p=tools%2Fmic.git fix empty value in max built-in Signed-off-by: Gui Chen --- diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index 8b00107..56b9a4f 100644 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -874,6 +874,9 @@ class LoopDevice(object): def _genloopid(self): import glob + if not glob.glob("/dev/loop[0-9]*"): + return 10 + fint = lambda x: x[9:].isdigit() and int(x[9:]) or 0 maxid = 1 + max(filter(lambda x: x<100, map(fint, glob.glob("/dev/loop[0-9]*"))))