From 09dbec99a05040244f1e4aca908552ba07a42052 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 11 Aug 2016 20:11:36 +0200 Subject: [PATCH] raise OSError including the error message derived from errno also: deal with path being a integer FD --- borg/xattr.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/borg/xattr.py b/borg/xattr.py index 94df6b05c..82a3afb4e 100644 --- a/borg/xattr.py +++ b/borg/xattr.py @@ -102,7 +102,13 @@ def _check(rv, path=None): if e == errno.ERANGE: raise BufferTooSmallError else: - raise OSError(e, path) + try: + msg = os.strerror(e) + except ValueError: + msg = '' + if isinstance(path, int): + path = '' % path + raise OSError(e, msg, path) return rv