X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fnet_setup.c;fp=src%2Fnet_setup.c;h=269b46ed0d4921d08bad76c9478d301b213ed95a;hp=b289a76504da93fed6159e7a2f1c0651fc9949bc;hb=4bfa6c6c9749fb3d8b73734ec7aa1ca51f813b5f;hpb=e40d5bf3a0e030105334046319f377efbf3f06c4 diff --git a/src/net_setup.c b/src/net_setup.c index b289a765..269b46ed 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -278,6 +278,15 @@ static bool load_node(meshlink_handle_t *mesh, const char *name, void *priv) { (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; }