-#define SELINUX_ACCESS_CHECK(connection, message, permission) \
- do { \
- DBusError _error; \
- int _r; \
- DBusConnection *_c = (connection); \
- DBusMessage *_m = (message); \
- dbus_error_init(&_error); \
- _r = selinux_access_check(_c, _m, NULL, (permission), &_error); \
- if (_r < 0) \
- return bus_send_error_reply(_c, _m, &_error, _r); \
- } while (false)
-
-#define SELINUX_UNIT_ACCESS_CHECK(unit, connection, message, permission) \
- do { \
- DBusError _error; \
- int _r; \
- DBusConnection *_c = (connection); \
- DBusMessage *_m = (message); \
- Unit *_u = (unit); \
- dbus_error_init(&_error); \
- _r = selinux_access_check(_c, _m, _u->source_path ?: _u->fragment_path, (permission), &_error); \
- if (_r < 0) \
- return bus_send_error_reply(_c, _m, &_error, _r); \
- } while (false)
+#define selinux_access_check(message, permission, error) \
+ selinux_generic_access_check((message), NULL, (permission), (error))
+
+#define selinux_unit_access_check(unit, message, permission, error) \
+ ({ \
+ Unit *_unit = (unit); \
+ selinux_generic_access_check((message), _unit->fragment_path ?: _unit->fragment_path, (permission), (error)); \
+ })