[glib/wip/gdbus-even-when-setcap: 1/3] gdbus: Improve readability by avoiding ternary operator
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gdbus-even-when-setcap: 1/3] gdbus: Improve readability by avoiding ternary operator
- Date: Tue, 2 Feb 2021 20:53:57 +0000 (UTC)
commit 7c0b9c776f6280eb5139017043877358a6ad9d7b
Author: Simon McVittie <smcv collabora com>
Date: Tue Feb 2 10:25:40 2021 +0000
gdbus: Improve readability by avoiding ternary operator
Signed-off-by: Simon McVittie <smcv collabora com>
gio/gdbusaddress.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index d26c4d25f..6d519a3f4 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -1330,7 +1330,11 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type,
switch (bus_type)
{
case G_BUS_TYPE_SYSTEM:
- ret = !is_setuid ? g_strdup (g_getenv ("DBUS_SYSTEM_BUS_ADDRESS")) : NULL;
+ if (is_setuid)
+ ret = NULL;
+ else
+ ret = g_strdup (g_getenv ("DBUS_SYSTEM_BUS_ADDRESS"));
+
if (ret == NULL)
{
ret = g_strdup ("unix:path=/var/run/dbus/system_bus_socket");
@@ -1338,7 +1342,11 @@ g_dbus_address_get_for_bus_sync (GBusType bus_type,
break;
case G_BUS_TYPE_SESSION:
- ret = !is_setuid ? g_strdup (g_getenv ("DBUS_SESSION_BUS_ADDRESS")) : NULL;
+ if (is_setuid)
+ ret = NULL;
+ else
+ ret = g_strdup (g_getenv ("DBUS_SESSION_BUS_ADDRESS"));
+
if (ret == NULL)
{
ret = get_session_address_platform_specific (&local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]