mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
param: make command_fail/command_success WARN_UNUSED_RESULT.
This causes a compiler warning if we don't do something with the result (hopefully return immediately!). We use was_pending() to ignore the result in the case where we complete a command in a callback (thus really do want to ignore the result). This actually fixes one bug: we didn't return after command_fail in json_getroute with a bad seed value. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -181,7 +181,7 @@ static void report_leak_info2(struct leak_info *leak_info)
|
||||
scan_mem(leak_info->cmd, response, leak_info->cmd->ld, leak_info->leaker);
|
||||
json_object_end(response);
|
||||
|
||||
command_success(leak_info->cmd, response);
|
||||
was_pending(command_success(leak_info->cmd, response));
|
||||
}
|
||||
|
||||
static void report_leak_info(struct command *cmd, struct subd *leaker)
|
||||
@@ -205,7 +205,8 @@ static void gossip_dev_memleak_done(struct subd *gossipd,
|
||||
bool found_leak;
|
||||
|
||||
if (!fromwire_gossip_dev_memleak_reply(reply, &found_leak)) {
|
||||
command_fail(cmd, LIGHTNINGD, "Bad gossip_dev_memleak");
|
||||
was_pending(command_fail(cmd, LIGHTNINGD,
|
||||
"Bad gossip_dev_memleak"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -221,7 +222,8 @@ static void connect_dev_memleak_done(struct subd *connectd,
|
||||
bool found_leak;
|
||||
|
||||
if (!fromwire_connect_dev_memleak_reply(reply, &found_leak)) {
|
||||
command_fail(cmd, LIGHTNINGD, "Bad connect_dev_memleak");
|
||||
was_pending(command_fail(cmd, LIGHTNINGD,
|
||||
"Bad connect_dev_memleak"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -243,7 +245,8 @@ static void hsm_dev_memleak_done(struct subd *hsmd,
|
||||
bool found_leak;
|
||||
|
||||
if (!fromwire_hsm_dev_memleak_reply(reply, &found_leak)) {
|
||||
command_fail(cmd, LIGHTNINGD, "Bad hsm_dev_memleak");
|
||||
was_pending(command_fail(cmd, LIGHTNINGD,
|
||||
"Bad hsm_dev_memleak"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -299,7 +302,7 @@ static struct command_result *json_memleak(struct command *cmd,
|
||||
|
||||
/* For simplicity, we mark pending, though an error may complete it
|
||||
* immediately. */
|
||||
command_still_pending(cmd);
|
||||
fixme_ignore(command_still_pending(cmd));
|
||||
|
||||
/* This calls opening_memleak_done() async when all done. */
|
||||
opening_dev_memleak(cmd);
|
||||
|
||||
Reference in New Issue
Block a user