summaryrefslogtreecommitdiff
path: root/bus/apparmor.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2016-02-10 13:15:56 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2016-02-11 02:06:02 +0100
commit881d7cb064ca4e268b060f898acef93c08a9e3b5 (patch)
treef7e0431dd66efe83737dcb1800c73b047f72b47d /bus/apparmor.c
parent5d67d56f5febb93e8881fbd6bc657b2ee885daf5 (diff)
downloaddbus-881d7cb064ca4e268b060f898acef93c08a9e3b5.tar.gz
AppArmor: do not mix dbus_bool_t with int
libdbus uses dbus_bool_t for booleans; that type is unsigned 32-bit. However, libapparmor uses int, which is signed, leading to -Wpointer-sign warnings when we pass a dbus_bool_t * where an int * was expected. This file is Linux-specific, and all Linux platforms have 32-bit int and an in-memory representation of the integers 0 and 1 that is independent of signedness, so the previous code was harmless in practice. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Diffstat (limited to 'bus/apparmor.c')
-rw-r--r--bus/apparmor.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bus/apparmor.c b/bus/apparmor.c
index 3ba84d8d..c679ac54 100644
--- a/bus/apparmor.c
+++ b/bus/apparmor.c
@@ -606,7 +606,9 @@ bus_apparmor_allows_acquire_service (DBusConnection *connection,
BusAppArmorConfinement *con = NULL;
DBusString qstr, auxdata;
dbus_bool_t free_auxdata = FALSE;
- dbus_bool_t allow = FALSE, audit = TRUE;
+ /* the AppArmor API uses pointers to int for pointers to boolean, and
+ * int is not strictly guaranteed to be the same as dbus_bool_t */
+ int allow = FALSE, audit = TRUE;
unsigned long pid;
int res, serrno = 0;
@@ -742,8 +744,8 @@ bus_apparmor_allows_send (DBusConnection *sender,
#ifdef HAVE_APPARMOR
BusAppArmorConfinement *src_con = NULL, *dst_con = NULL;
DBusString qstr, auxdata;
- dbus_bool_t src_allow = FALSE, dst_allow = FALSE;
- dbus_bool_t src_audit = TRUE, dst_audit = TRUE;
+ int src_allow = FALSE, dst_allow = FALSE;
+ int src_audit = TRUE, dst_audit = TRUE;
dbus_bool_t free_auxdata = FALSE;
unsigned long pid;
int len, res, src_errno = 0, dst_errno = 0;
@@ -1006,7 +1008,7 @@ bus_apparmor_allows_eavesdropping (DBusConnection *connection,
#ifdef HAVE_APPARMOR
BusAppArmorConfinement *con = NULL;
DBusString qstr, auxdata;
- dbus_bool_t allow = FALSE, audit = TRUE;
+ int allow = FALSE, audit = TRUE;
dbus_bool_t free_auxdata = FALSE;
unsigned long pid;
int res, serrno = 0;