From 264f847d07edb4d79a91e0406ccac0127e07424e Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Fri, 19 Aug 2016 11:03:28 +0200 Subject: Fix warnings from compiler option '-Wdiscarded-qualifiers' Signed-off-by: Thomas Zimmermann --- bus/driver.c | 3 ++- dbus/dbus-spawn-test.c | 9 +++++---- dbus/dbus-sysdeps-unix.c | 13 +++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bus/driver.c b/bus/driver.c index 4eaa1b0..a53af64 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -1528,6 +1528,8 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection, DBusMessage *message, DBusError *error) { + static const char dbus_service_name[] = DBUS_SERVICE_DBUS; + const char *text; DBusList *base_names; DBusList *link; @@ -1536,7 +1538,6 @@ bus_driver_handle_list_queued_owners (DBusConnection *connection, BusService *service; DBusMessage *reply; DBusMessageIter iter, array_iter; - const char *dbus_service_name = DBUS_SERVICE_DBUS; _DBUS_ASSERT_ERROR_IS_CLEAR (error); diff --git a/dbus/dbus-spawn-test.c b/dbus/dbus-spawn-test.c index 7dd3dc4..b9417aa 100644 --- a/dbus/dbus-spawn-test.c +++ b/dbus/dbus-spawn-test.c @@ -56,15 +56,16 @@ get_test_exec (const char *exe, static dbus_bool_t check_spawn_nonexistent (void *data) { - const char *argv[4] = { NULL, NULL, NULL, NULL }; + static char arg_does_not_exist[] = "/this/does/not/exist/32542sdgafgafdg"; + + char *argv[4] = { NULL, NULL, NULL, NULL }; DBusBabysitter *sitter = NULL; DBusError error = DBUS_ERROR_INIT; /*** Test launching nonexistent binary */ - argv[0] = "/this/does/not/exist/32542sdgafgafdg"; - if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_nonexistent", - (char * const *) argv, + argv[0] = arg_does_not_exist; + if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_nonexistent", argv, NULL, DBUS_SPAWN_NONE, NULL, NULL, &error)) { diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index d7f0454..0401895 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -3758,6 +3758,11 @@ _dbus_get_autolaunch_address (const char *scope, DBusError *error) { #ifdef DBUS_ENABLE_X11_AUTOLAUNCH + static char arg_dbus_launch[] = "dbus-launch"; + static char arg_autolaunch[] = "--autolaunch"; + static char arg_binary_syntax[] = "--binary-syntax"; + static char arg_close_stderr[] = "--close-stderr"; + /* Perform X11-based autolaunch. (We also support launchd-based autolaunch, * but that's done elsewhere, and if it worked, this function wouldn't * be called.) */ @@ -3818,15 +3823,15 @@ _dbus_get_autolaunch_address (const char *scope, * see fd.o#69716 */ i = 0; - argv[i] = "dbus-launch"; + argv[i] = arg_dbus_launch; ++i; - argv[i] = "--autolaunch"; + argv[i] = arg_autolaunch; ++i; argv[i] = _dbus_string_get_data (&uuid); ++i; - argv[i] = "--binary-syntax"; + argv[i] = arg_binary_syntax; ++i; - argv[i] = "--close-stderr"; + argv[i] = arg_close_stderr; ++i; argv[i] = NULL; ++i; -- 2.7.4