2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +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:
Ryan Lee
2024-09-18 11:12:00 -07:00
parent 65e6620014
commit 436ebda9b5

View File

@@ -31,8 +31,9 @@ extern int _aa_is_blacklisted(const char *name);
%exception {
$action
if (result < 0) {
// Unfortunately SWIG_exception does not support OSError
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
SWIG_fail;
}
}
#endif