From: Lawrence S. <ljs...@us...> - 2019-09-10 01:25:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e8f838ec54b5fbf9d8ce8780cfc48b4bcbcf1b9f (commit) from 030c480e9a27a58c4aa228c354d85bb15721551f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e8f838ec54b5fbf9d8ce8780cfc48b4bcbcf1b9f Author: Lawrence Sebald <ljs...@us...> Date: Mon Sep 9 21:19:39 2019 -0400 libkosfat: Fix yet more issues with handling cross-block/cluster longname entries. ----------------------------------------------------------------------- Summary of changes: addons/libkosfat/directory.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/addons/libkosfat/directory.c b/addons/libkosfat/directory.c index b9c744e..e71ec74 100644 --- a/addons/libkosfat/directory.c +++ b/addons/libkosfat/directory.c @@ -306,6 +306,15 @@ static int fat_search_long(fat_fs_t *fs, const char *fn, uint32_t cluster, /* The next entry should be the dentry we want (that is to say, the short name entry for this long name). */ if(i < max) { + if(cluster != cluster2) { + if(!(cl = fat_cluster_read(fs, cluster, &err))) { + dbglog(DBG_ERROR, "Error reading directory at " + "cluster %" PRIu32 ": %s\n", cluster, + strerror(err)); + return -EIO; + } + } + ent = (fat_dentry_t *)(cl + ((i + 1) << 5)); /* Make sure we got a valid short entry... */ @@ -644,6 +653,8 @@ int fat_erase_dentry(fat_fs_t *fs, uint32_t cl, uint32_t off, uint32_t lcl, max2 = (int32_t)fs->sb.root_dir; } + i = loff >> 5; + while(!done) { if(!(buf = fat_cluster_read(fs, lcl, &err))) { dbglog(DBG_ERROR, "Error reading directory entry at cluster %" @@ -655,7 +666,7 @@ int fat_erase_dentry(fat_fs_t *fs, uint32_t cl, uint32_t off, uint32_t lcl, /* Just go ahead and do this now to save us the trouble later... */ fat_cluster_mark_dirty(fs, lcl); - for(i = loff >> 5; i < max; ++i) { + for(; i < max; ++i) { ent = (fat_dentry_t *)(buf + (i << 5)); /* If name[0] is zero, then we've hit the end of the @@ -704,6 +715,8 @@ int fat_erase_dentry(fat_fs_t *fs, uint32_t cl, uint32_t off, uint32_t lcl, ", offset %" PRIu32 "\n", lcl, i << 5); return -EIO; } + + i = 0; } else { ++lcl; @@ -715,6 +728,8 @@ int fat_erase_dentry(fat_fs_t *fs, uint32_t cl, uint32_t off, uint32_t lcl, ", offset %" PRIu32 "\n", lcl, i << 5); return -EIO; } + + i = 0; } } } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |