]> git.meshlink.io Git - meshlink/blobdiff - src/conf.c
Refuse invitees if we can't delete the invitation file.
[meshlink] / src / conf.c
index eea9c3dd6245b8e8432af30f511d41c6f0f0ace6..ca107b0a062c6dc5470dab09e8da44a909a0b4f4 100644 (file)
@@ -866,7 +866,19 @@ bool invitation_read(meshlink_handle_t *mesh, const char *conf_subdir, const cha
 
        fclose(f);
 
-       unlink(used_path);
+       if(unlink(used_path)) {
+               logger(mesh, MESHLINK_ERROR, "Failed to unlink `%s': %s", path, strerror(errno));
+               return false;
+       }
+
+       snprintf(path, sizeof(path), "%s" SLASH "%s" SLASH "invitations", mesh->confbase, conf_subdir);
+
+       if(!sync_path(path)) {
+               logger(mesh, MESHLINK_ERROR, "Failed to sync `%s': %s", path, strerror(errno));
+               meshlink_errno = MESHLINK_ESTORAGE;
+               return false;
+       }
+
        return true;
 }