summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2013-05-17 02:00:07 -0400
committerGui Chen <gui.chen@intel.com>2013-05-17 02:00:59 -0400
commit2d76282e8f2c33f345eab62388e3b6ffd931982c (patch)
treed1612b691ef548d855bc46bec72a378ae9adacfd
parentb7b83a3459fad05f10fd2ac57ada3a1bc58c46af (diff)
downloadmic-2d76282e8f2c33f345eab62388e3b6ffd931982c.tar.gz
mic-2d76282e8f2c33f345eab62388e3b6ffd931982c.tar.bz2
mic-2d76282e8f2c33f345eab62388e3b6ffd931982c.zip
fix empty value in max built-in
Signed-off-by: Gui Chen <gui.chen@intel.com>
-rw-r--r--mic/utils/fs_related.py3
1 files changed, 3 insertions, 0 deletions
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]*"))))