network: Change func. signature
PATCH 1/1 network: Change func. signature
Change signature of network_connect_new_hidden_network to take reference to the caller's l_dbus_message struct. This allows to set the caller's l_dbus_message struct to NULL after replying in the case of a failure.
==201== at 0x467C15: l_dbus_message_unref (dbus-message.c:412) ==201== by 0x412A51: station_hidden_network_scan_results (station.c:2504) ==201== by 0x41EAEA: scan_finished (scan.c:1505) ==201== by 0x41EC10: get_scan_done (scan.c:1535) ==201== by 0x462592: destroy_request (genl.c:673) ==201== by 0x462987: process_unicast (genl.c:988) ==201== by 0x462987: received_data (genl.c:1087) ==201== by 0x45F5A2: io_callback (io.c:126) ==201== by 0x45E8FD: l_main_iterate (main.c:474) ==201== by 0x45E9BB: l_main_run (main.c:521) ==201== by 0x45EBCA: l_main_run_with_signal (main.c:643) ==201== by 0x403B15: main (main.c:512) --- src/network.c | 12 ++++++------ src/network.h | 2 +- src/station.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
src/network.c +6 -6
@@ -1166,7 +1166,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus, }void network_connect_new_hidden_network (struct network *network, -struct l_dbus_message *message) +struct l_dbus_message **message) {struct station *station = network->station;struct scan_bss *bss;
@@ -1183,7 +1183,7 @@ void network_connect_new_hidden_network(struct network *network, bss =network_bss_select (network, true);if (!bss) {/* This should never happened for the hidden networks. */ - error =dbus_error_not_supported (message); + error =dbus_error_not_supported (*message); goto reply_error; }
@@ -1192,13 +1192,13 @@ void network_connect_new_hidden_network(struct network *network,switch (network_get_security (network)) {case SECURITY_PSK : - error =network_connect_psk (network, bss, message); + error =network_connect_psk (network, bss, *message);break ;case SECURITY_NONE : -station_connect_network (station, network, bss, message); +station_connect_network (station, network, bss, *message);return ;default : - error =dbus_error_not_supported (message); + error =dbus_error_not_supported (*message);break ; }
@@ -1208,7 +1208,7 @@ void network_connect_new_hidden_network(struct network *network,return ; reply_error: -dbus_pending_reply (&message, error); +dbus_pending_reply (message, error); }void network_blacklist_add (struct network *network,struct scan_bss *bss)
src/network.h +1 -1
@@ -70,7 +70,7 @@ int network_rank_compare(const void *a, const void *b, void *user);void network_rank_update (struct network *network,bool connected);void network_connect_new_hidden_network (struct network *network, -struct l_dbus_message *message); +struct l_dbus_message **message);void network_blacklist_add (struct network *network,struct scan_bss *bss);
src/station.c +1 -1
@@ -2500,7 +2500,7 @@ next: network = network_psk ? : network_open; -network_connect_new_hidden_network (network, msg); +network_connect_new_hidden_network (network, &msg);l_dbus_message_unref (msg);return true;
Signature · 1 line
2.13.6
Hi Tim,
Quoted 14 lines · Tim Kourt
Change signature of
network_connect_new_hidden_networkto take reference to the caller'sl_dbus_messagestruct. This allows to set the caller'sl_dbus_messagestruct to NULL after replying in the case of a failure.==201== at 0x467C15: l_dbus_message_unref (dbus-message.c:412) ==201== by 0x412A51: station_hidden_network_scan_results (station.c:2504) ==201== by 0x41EAEA: scan_finished (scan.c:1505) ==201== by 0x41EC10: get_scan_done (scan.c:1535) ==201== by 0x462592: destroy_request (genl.c:673) ==201== by 0x462987: process_unicast (genl.c:988) ==201== by 0x462987: received_data (genl.c:1087) ==201== by 0x45F5A2: io_callback (io.c:126) ==201== by 0x45E8FD: l_main_iterate (main.c:474)
Quoted 9 lines
==201== by 0x45E9BB: l_main_run (main.c:521) ==201== by 0x45EBCA: l_main_run_with_signal (main.c:643) ==201== by 0x403B15: main (main.c:512) --- src/network.c | 12 ++++++------ src/network.h | 2 +- src/station.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
Applied after rewording the commit header slightly.
Regards,
-Denis