]> git.meshlink.io Git - meshlink/commitdiff
Sync the base configuration directory after each subdirectory rename operation.
authorGuus Sliepen <guus@meshlink.io>
Thu, 28 Nov 2019 21:21:19 +0000 (22:21 +0100)
committerGuus Sliepen <guus@meshlink.io>
Thu, 28 Nov 2019 21:21:19 +0000 (22:21 +0100)
This ensures the proper ordering of the renames in the event of a crash.

src/conf.c

index 9cf76fbea7de8bd5dbda8a8a32e362b607674cc4..9527c1edf5c13cda07db36b6255ec4ee777b078e 100644 (file)
@@ -397,7 +397,7 @@ bool config_rename(meshlink_handle_t *mesh, const char *old_conf_subdir, const c
        snprintf(old_path, sizeof(old_path), "%s" SLASH "%s", mesh->confbase, old_conf_subdir);
        snprintf(new_path, sizeof(new_path), "%s" SLASH "%s", mesh->confbase, new_conf_subdir);
 
-       return rename(old_path, new_path) == 0;
+       return rename(old_path, new_path) == 0 && sync_path(mesh->confbase);
 }
 
 bool config_sync(meshlink_handle_t *mesh, const char *conf_subdir) {