Skip to content

Commit

Permalink
Check return value of read_all(...) call
Browse files Browse the repository at this point in the history
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)))
```
  • Loading branch information
practicalswift authored and rustyrussell committed Jan 10, 2018
1 parent 5043e20 commit e8c94c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/test_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,9 @@ static void do_cmd(struct peer *peer)
} else if (streq(cmd, "restore")) {
write_all(peer->cmddonefd, "", 1);
/* 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);
} else if (streq(cmd, "checksync")) {
struct commit_tx ours, theirs;
Expand Down

0 comments on commit e8c94c2

Please sign in to comment.