+bool write_host_config(struct meshlink_handle *mesh, const struct splay_tree_t *config_tree, const char *name) {
+ char filename[PATH_MAX];
+
+ snprintf(filename, PATH_MAX, "%s" SLASH "hosts" SLASH "%s", mesh->confbase, name);
+ return write_config_file(config_tree, filename);
+}
+
+bool modify_config_file(struct meshlink_handle *mesh, const char *name, const char *key, const char *value, int trim) {
+ assert(mesh && name && key);
+
+ char filename[PATH_MAX];
+ char tmpname[PATH_MAX];
+ bool error = false;
+
+ if(snprintf(filename, sizeof(filename), "%s" SLASH "hosts" SLASH "%s", mesh->confbase, name) >= PATH_MAX) {
+ logger(mesh, MESHLINK_ERROR, "Filename too long: %s" SLASH "hosts" SLASH "%s", mesh->confbase, name);
+ return false;
+ }
+
+ if(snprintf(tmpname, sizeof(tmpname), "%s.tmp", filename) >= PATH_MAX) {
+ logger(mesh, MESHLINK_ERROR, "Filename too long: %s.tmp", filename);
+ return false;
+ }