aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2020-09-01 21:35:53 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2020-09-01 21:35:53 -0400
commitcf7cab4ede7d84ce110248de1606805b8c593da7 (patch)
tree8975bfa3f8281f775217e6ebb974fb44c1e5b6ed
parent506248e3f363bb6aef3b9b5882e7a92afa957088 (diff)
downloadmultihome-cf7cab4ede7d84ce110248de1606805b8c593da7.tar.gz
set new path to old path in update mode
-rw-r--r--multihome.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/multihome.c b/multihome.c
index 5715833..77ab821 100644
--- a/multihome.c
+++ b/multihome.c
@@ -644,7 +644,14 @@ int main(int argc, char *argv[]) {
sprintf(multihome.config_init, "%s/init", multihome.config_dir);
sprintf(multihome.config_transfer, "%s/transfer", multihome.config_dir);
sprintf(multihome.config_skeleton, "%s/skel/", multihome.config_dir);
- sprintf(multihome.path_new, "%s/%s/%s", multihome.path_old, multihome.path_root, nodename);
+
+ // Update mode uses the current $HOME, so set .path_new to .path_old
+ if (arguments.update) {
+ strcpy(multihome.path_new, multihome.path_old);
+ } else { // Construct .path_new normally
+ sprintf(multihome.path_new, "%s/%s/%s", multihome.path_old, multihome.path_root, nodename);
+ }
+
sprintf(multihome.path_topdir, "%s/topdir", multihome.path_new);
sprintf(multihome.marker, "%s/.multihome_controlled", multihome.path_new);