If test specified that this disconnection should cause permanent failure */
| 946 | |
| 947 | /* If test specified that this disconnection should cause permanent failure */ |
| 948 | bool dev_disconnect_permanent(struct lightningd *ld) |
| 949 | { |
| 950 | char permfail[sizeof("PERMFAIL") - 1]; |
| 951 | int r; |
| 952 | |
| 953 | if (ld->dev_disconnect_fd == -1) |
| 954 | return false; |
| 955 | |
| 956 | r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail)); |
| 957 | if (r < 0) |
| 958 | fatal("Reading dev_disconnect file: %s", strerror(errno)); |
| 959 | |
| 960 | if (memeq(permfail, r, "permfail", strlen("permfail"))) |
| 961 | return true; |
| 962 | |
| 963 | /* Nope, restore. */ |
| 964 | if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) { |
| 965 | fatal("lseek failure"); |
| 966 | } |
| 967 | return false; |
| 968 | } |
| 969 | |
| 970 | /* Ugly helper to get full pathname of the current binary. */ |
| 971 | const char *find_my_abspath(const tal_t *ctx, const char *argv0) |
no test coverage detected