From 9d10a5ce2b4c776b6268fe48a62d85d03ad7b0ed Mon Sep 17 00:00:00 2001 From: Adrian Szyndela Date: Fri, 6 Jul 2018 11:07:10 +0200 Subject: [PATCH] busctl: eliminated some warnings Eliminated const and casting warnings, along with a declaration order warning. Change-Id: I031a5d3d7bab61a2ec7afc6262eb12af159a74c8 --- src/libsystemd/sd-bus/bus-dump.c | 2 +- src/libsystemd/sd-bus/bus-dump.h | 2 +- src/libsystemd/sd-bus/busctl.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 301915d..874f82b 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -109,7 +109,7 @@ int bus_message_dot_dump(sd_bus_message *m, FILE *f) { return 0; } -void dot_dump_unique_name(sd_bus *bus, char *name, Hashmap *hashmap_wkn, FILE *f, sd_bus_message *m) { +void dot_dump_unique_name(sd_bus *bus, const char *name, Hashmap *hashmap_wkn, FILE *f, sd_bus_message *m) { int r; bool update = false; int obtained; diff --git a/src/libsystemd/sd-bus/bus-dump.h b/src/libsystemd/sd-bus/bus-dump.h index 1a5e9bc..dd427dd7 100644 --- a/src/libsystemd/sd-bus/bus-dump.h +++ b/src/libsystemd/sd-bus/bus-dump.h @@ -31,7 +31,7 @@ enum { }; int bus_message_dot_dump(sd_bus_message *m, FILE *f); -void dot_dump_unique_name(sd_bus *bus, char *name, Hashmap *hashmap_wkn, FILE *f, sd_bus_message *m); +void dot_dump_unique_name(sd_bus *bus, const char *name, Hashmap *hashmap_wkn, FILE *f, sd_bus_message *m); int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags); diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c index b9f10a1..2d3aeb3 100644 --- a/src/libsystemd/sd-bus/busctl.c +++ b/src/libsystemd/sd-bus/busctl.c @@ -1097,7 +1097,7 @@ static int message_dot(sd_bus_message *m, FILE *f, Hashmap *hashmap_wkn, sd_bus return bus_message_dot_dump(m, f); } -static bool check_pid(sd_bus *bus, Hashmap *hashmap_pids, char *name, int compare_pid) { +static bool check_pid(sd_bus *bus, Hashmap *hashmap_pids, const char *name, int compare_pid) { pid_t pid; sd_bus_creds *creds = NULL; int r; @@ -1105,7 +1105,7 @@ static bool check_pid(sd_bus *bus, Hashmap *hashmap_pids, char *name, int compar if (!name) return false; - pid = hashmap_get(hashmap_pids, name); + pid = (pid_t)hashmap_get(hashmap_pids, name); if (pid == 0) { r = sd_bus_get_name_creds(bus, name, SD_BUS_CREDS_PID, &creds); if (r >= 0) @@ -1114,7 +1114,7 @@ static bool check_pid(sd_bus *bus, Hashmap *hashmap_pids, char *name, int compar if (r < 0) return false; - hashmap_put(hashmap_pids, strdup(name), pid); + hashmap_put(hashmap_pids, strdup(name), (void*)pid); } if (compare_pid == pid) @@ -1259,11 +1259,11 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL return r; while (monitor_run_condi) { + _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; + receiver_pid_match = true; sender_pid_match = true; - _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; - r = sd_bus_process(bus, &m); if (r < 0) return log_error_errno(r, "Failed to process bus: %m"); -- 2.7.4