mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-02 15:25:27 +00:00
Use SWIG_fail in %exception upon throwing OSError for errno
Unfortunately SWIG_exception does not support throwing OSError, so this still requires Python-specific code. Unlike just returning NULL, this will clean up intermediate allocations. Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
@@ -31,8 +31,9 @@ extern int _aa_is_blacklisted(const char *name);
|
|||||||
%exception {
|
%exception {
|
||||||
$action
|
$action
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
// Unfortunately SWIG_exception does not support OSError
|
||||||
PyErr_SetFromErrno(PyExc_OSError);
|
PyErr_SetFromErrno(PyExc_OSError);
|
||||||
return NULL;
|
SWIG_fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user