qubesutils.py: don't fail on broken symlinks
This commit is contained in:
parent
1840420331
commit
624ab67e86
@ -95,8 +95,8 @@ def get_disk_usage_one(st):
|
|||||||
|
|
||||||
def get_disk_usage(path):
|
def get_disk_usage(path):
|
||||||
try:
|
try:
|
||||||
st = os.stat(path)
|
st = os.lstat(path)
|
||||||
except os.error:
|
except OSError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
ret = get_disk_usage_one(st)
|
ret = get_disk_usage_one(st)
|
||||||
@ -104,7 +104,7 @@ def get_disk_usage(path):
|
|||||||
# if path is not a directory, this is skipped
|
# if path is not a directory, this is skipped
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
for name in dirnames + filenames:
|
for name in dirnames + filenames:
|
||||||
ret += get_disk_usage_one(os.stat(os.path.join(dirpath, name)))
|
ret += get_disk_usage_one(os.lstat(os.path.join(dirpath, name)))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user