diff options
-rw-r--r-- | openbsd/__init__.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/openbsd/__init__.py b/openbsd/__init__.py index 1aab185..e321f61 100644 --- a/openbsd/__init__.py +++ b/openbsd/__init__.py @@ -1,5 +1,6 @@ import sys +import os from cffi import FFI from ._openbsd import lib as _lib @@ -14,7 +15,7 @@ def pledge(promises=None, execpromises=None): ret = _lib.pledge(promises, execpromises) if ret < 0: errno = _ffi.errno - raise OSError(errno, _decode(_ffi.string(_lib.strerror(errno), 256))) + raise OSError(errno, os.strerror(errno)) def unveil(path=None, permissions=None): @@ -23,7 +24,7 @@ def unveil(path=None, permissions=None): ret = _lib.unveil(path, permissions) if ret < 0: errno = _ffi.errno - raise OSError(errno, _decode(_ffi.string(_lib.strerror(errno), 256))) + raise OSError(errno, os.strerror(errno)) if isinstance(b"openbsd", str): @@ -32,9 +33,6 @@ if isinstance(b"openbsd", str): if isinstance(text, unicode): return text.encode("ascii") return text - - def _decode(text): - return text else: # Python 3 def _encode(text): @@ -42,7 +40,4 @@ else: return text.encode("ascii") return text - def _decode(text): - return text.decode("ascii") - |