Browse Source

lightningd: remove lightning-rpc file on migration.

Fixes: #3378
Closes: #3379
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
387cd400d4
  1. 11
      lightningd/options.c

11
lightningd/options.c

@ -915,12 +915,21 @@ static void promote_missing_files(struct lightningd *ld)
if (streq(d->d_name, ".") if (streq(d->d_name, ".")
|| streq(d->d_name, "..") || streq(d->d_name, "..")
|| streq(d->d_name, "config") || streq(d->d_name, "config")
|| streq(d->d_name, "lightning-rpc")
|| strends(d->d_name, ".pid")) || strends(d->d_name, ".pid"))
continue; continue;
fullname = path_join(tmpctx, ld->config_basedir, d->d_name); 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. */ /* Ignore any directories. */
if (lstat(fullname, &st) != 0) if (lstat(fullname, &st) != 0)
errx(1, "Could not stat %s", fullname); errx(1, "Could not stat %s", fullname);

Loading…
Cancel
Save