From 2933f0d54a0185ef415736eea65a277d5d151ace Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 10 Feb 2016 13:15:56 +0000 Subject: [PATCH 6/7] 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 --- bus/apparmor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bus/apparmor.c b/bus/apparmor.c index 3ba84d8..c679ac5 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; -- 2.7.0