diff options
author | Gui Chen <gui.chen@intel.com> | 2013-05-17 02:00:07 -0400 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2013-05-17 02:00:59 -0400 |
commit | 2d76282e8f2c33f345eab62388e3b6ffd931982c (patch) | |
tree | d1612b691ef548d855bc46bec72a378ae9adacfd | |
parent | b7b83a3459fad05f10fd2ac57ada3a1bc58c46af (diff) | |
download | mic-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.py | 3 |
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]*")))) |