When something happens while a host config files is written, a temporary
file might be left over. Clean these up when we find them when starting
MeshLink.
(void)priv;
if(!check_id(name)) {
+ // Check if this is a temporary file, if so remove it
+ const char *suffix = strstr(name, ".tmp");
+
+ if(suffix && !suffix[4]) {
+ char filename[PATH_MAX];
+ snprintf(filename, sizeof(filename), "%s" SLASH "current" SLASH "hosts", mesh->confbase);
+ unlink(filename);
+ }
+
return true;
}