lightningd/subd.c
bool dev_disconnect_permanent(struct lightningd *ld)
{
	char permfail[strlen("PERMFAIL")];
	int r;

	if (ld->dev_disconnect_fd == -1)
		return false;

	r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail));
	if (r < 0)
		fatal("Reading dev_disconnect file: %s", strerror(errno));

	if (memeq(permfail, r, "permfail", strlen("permfail")))
		return true;

	/* Nope, restore. */
	if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) {
		fatal("lseek failure");
	}
	return false;
}
/* If test specified that this disconnection should cause permanent failure */
If test specified that this disconnection should cause permanent failure
If test specified that this disconnection should cause permanent failure
bool dev_disconnect_permanent(struct lightningd *ld)
{
	char permfail[strlen("PERMFAIL")];
	int r;
	if (ld->dev_disconnect_fd == -1)
		return false;
	r = read(ld->dev_disconnect_fd, permfail, sizeof(permfail));
	if (r < 0)
		fatal("Reading dev_disconnect file: %s", strerror(errno));
	if (memeq(permfail, r, "permfail", strlen("permfail")))
		return true;
	if (lseek(ld->dev_disconnect_fd, -r, SEEK_CUR) < 0) {
		fatal("lseek failure");
	}
	return false;
}
bool dev_disconnect_permanent ( struct lightningd * ld ) { char permfail [ strlen ( " " ) ] ; int r ; if ( ld -> dev_disconnect_fd == -1 ) return false ; r = read ( ld -> dev_disconnect_fd , permfail , sizeof ( permfail ) ) ; if ( r < 0 ) fatal ( " " , strerror ( errno ) ) ; if ( memeq ( permfail , r , " " , strlen ( " " ) ) ) return true ; if ( lseek ( ld -> dev_disconnect_fd , - r , SEEK_CUR ) < 0 ) { fatal ( " " ) ; } return false ; }
If test specified that this disconnection should cause permanent failure
If test specified that this disconnection should cause permanent failure
/* Nope, restore. */