X-Git-Url: http://git.sven.stormbind.net/?p=sven%2Fexfat-utils.git;a=blobdiff_plain;f=libexfat%2Fnode.c;h=4dd4dc6a4c6085a8a8f3622609951451aa7b2d87;hp=f3d10e0ef8d05cc1a6be8c162f919b73e1071011;hb=0851763ab394b718156526df2ebc1412e5b0f8b0;hpb=9420cfdeee25e4d97e7fc6f7cbb286e5089caccb diff --git a/libexfat/node.c b/libexfat/node.c index f3d10e0..4dd4dc6 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -664,7 +664,7 @@ int exfat_flush_node(struct exfat* ef, struct exfat_node* node) } node->flags &= ~EXFAT_ATTRIB_DIRTY; - return 0; + return exfat_flush(ef); } static bool erase_entry(struct exfat* ef, struct exfat_node* node) @@ -1129,6 +1129,16 @@ int exfat_rename(struct exfat* ef, const char* old_path, const char* new_path) } exfat_put_node(ef, existing); if (rc != 0) + { + /* free clusters even if something went wrong; overwise they + will be just lost */ + exfat_cleanup_node(ef, existing); + exfat_put_node(ef, dir); + exfat_put_node(ef, node); + return rc; + } + rc = exfat_cleanup_node(ef, existing); + if (rc != 0) { exfat_put_node(ef, dir); exfat_put_node(ef, node);