| 296 | } |
| 297 | |
| 298 | static void create_hsm(int fd) |
| 299 | { |
| 300 | /*~ ccan/read_write_all has a more convenient return than write() where |
| 301 | * we'd have to check the return value == the length we gave: write() |
| 302 | * can return short on normal files if we run out of disk space. */ |
| 303 | if (!write_all(fd, &hsm_secret, sizeof(hsm_secret))) { |
| 304 | /* ccan/noerr contains useful routines like this, which don't |
| 305 | * clobber errno, so we can use it in our error report. */ |
| 306 | unlink_noerr("hsm_secret"); |
| 307 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 308 | "writing: %s", strerror(errno)); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | /*~ We store our root secret in a "hsm_secret" file (like all of Core Lightning, |
| 313 | * we run in the user's .lightning directory). */ |
no test coverage detected