mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
Check return value of read_all(...) call
All other users of read_all(...) check the return value: ``` hsmd/hsm.c: if (!read_all(fd, &secretstuff.hsm_secret, sizeof(secretstuff.hsm_secret))) test/test_protocol.c: if (!read_all(fd, p, len)) wire/wire_sync.c: if (!read_all(fd, &len, sizeof(len))) wire/wire_sync.c: if (!read_all(fd, msg, wirelen_to_cpu(len))) ```
This commit is contained in:
committed by
Rusty Russell
parent
5043e201b8
commit
e8c94c2e29
@@ -981,7 +981,9 @@ static void do_cmd(struct peer *peer)
|
|||||||
} else if (streq(cmd, "restore")) {
|
} else if (streq(cmd, "restore")) {
|
||||||
write_all(peer->cmddonefd, "", 1);
|
write_all(peer->cmddonefd, "", 1);
|
||||||
/* Ack, then read in blob */
|
/* Ack, then read in blob */
|
||||||
read_all(peer->cmdfd, &peer->db, sizeof(peer->db));
|
if (!read_all(peer->cmdfd, &peer->db, sizeof(peer->db))) {
|
||||||
|
errx(1, "Read failed for command \"restore\"");
|
||||||
|
}
|
||||||
restore_state(peer);
|
restore_state(peer);
|
||||||
} else if (streq(cmd, "checksync")) {
|
} else if (streq(cmd, "checksync")) {
|
||||||
struct commit_tx ours, theirs;
|
struct commit_tx ours, theirs;
|
||||||
|
|||||||
Reference in New Issue
Block a user