If test specified that this disconnection should cause permanent failure */
| 936 | |
| 937 | /* If test specified that this disconnection should cause permanent failure */ |
| 938 | bool dev_disconnect_permanent(struct lightningd *ld) |
| 939 | { |
| 940 | char permfail[strlen("PERMFAIL")]; |
| 941 | int r; |
| 942 | |
| 943 | if (ld->dev_disconnect_fd == -1) |
| 944 | return false; |
| 945 | |
| 946 | r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail)); |
| 947 | if (r < 0) |
| 948 | fatal("Reading dev_disconnect file: %s", strerror(errno)); |
| 949 | |
| 950 | if (memeq(permfail, r, "permfail", strlen("permfail"))) |
| 951 | return true; |
| 952 | |
| 953 | /* Nope, restore. */ |
| 954 | if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) { |
| 955 | fatal("lseek failure"); |
| 956 | } |
| 957 | return false; |
| 958 | } |
| 959 | #endif /* DEVELOPER */ |
| 960 | |
| 961 | /* Ugly helper to get full pathname of the current binary. */ |
no test coverage detected