lightningd: remove lightning-rpc file on migration.

Fixes: #3378
Closes: #3379
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-01-28 13:36:51 +10:30 committed by Christian Decker
parent 06c5663f75
commit 387cd400d4
1 changed files with 10 additions and 1 deletions

View File

@ -915,12 +915,21 @@ static void promote_missing_files(struct lightningd *ld)
if (streq(d->d_name, ".")
|| streq(d->d_name, "..")
|| streq(d->d_name, "config")
|| streq(d->d_name, "lightning-rpc")
|| strends(d->d_name, ".pid"))
continue;
fullname = path_join(tmpctx, ld->config_basedir, d->d_name);
/* Simply remove rpc file: if they use --rpc-file to place it
* here explicitly it will get recreated, but moving it would
* be confusing as it would be unused. */
if (streq(d->d_name, "lightning-rpc")) {
if (unlink(fullname) != 0)
log_unusual(ld->log, "Could not unlink %s: %s",
fullname, strerror(errno));
continue;
}
/* Ignore any directories. */
if (lstat(fullname, &st) != 0)
errx(1, "Could not stat %s", fullname);