| 417 | } |
| 418 | |
| 419 | const char *subdaemon_path(const tal_t *ctx, const struct lightningd *ld, const char *name) |
| 420 | { |
| 421 | /* Strip the leading "lightning_" before looking in alt_subdaemons. |
| 422 | */ |
| 423 | size_t pfxlen = strlen("lightning_"); |
| 424 | assert(strlen(name) > pfxlen); |
| 425 | const char *short_name = tal_strdup(ctx, name + pfxlen); |
| 426 | |
| 427 | /* Is there an alternate path for this subdaemon? */ |
| 428 | const char *dpath; |
| 429 | const char *alt = strmap_get(&ld->alt_subdaemons, short_name); |
| 430 | if (alt) { |
| 431 | /* path_join will honor absolute paths as well. */ |
| 432 | dpath = path_join(ctx, ld->subdaemon_dir, alt); |
| 433 | } else { |
| 434 | /* This subdaemon is found in the standard place. */ |
| 435 | dpath = path_join(ctx, ld->subdaemon_dir, name); |
| 436 | } |
| 437 | return dpath; |
| 438 | } |
| 439 | |
| 440 | /*~ Check we can run them, and check their versions */ |
| 441 | void test_subdaemons(const struct lightningd *ld) |