From 624ab67e86b93a123c964a49b6b015c981dae367 Mon Sep 17 00:00:00 2001 From: Wojciech Zygmunt Porczyk Date: Fri, 2 May 2014 16:59:17 +0200 Subject: [PATCH] qubesutils.py: don't fail on broken symlinks --- core/qubesutils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/qubesutils.py b/core/qubesutils.py index 26666af3..a1ba0ffe 100644 --- a/core/qubesutils.py +++ b/core/qubesutils.py @@ -95,8 +95,8 @@ def get_disk_usage_one(st): def get_disk_usage(path): try: - st = os.stat(path) - except os.error: + st = os.lstat(path) + except OSError: return 0 ret = get_disk_usage_one(st) @@ -104,7 +104,7 @@ def get_disk_usage(path): # if path is not a directory, this is skipped for dirpath, dirnames, filenames in os.walk(path): 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