[syslinux:fsc] fs: generic handling of single dot (.) in disk-based filesystems
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Thu Feb 4 18:18:02 PST 2010
Commit-ID: 88f16f147237ab25ffd83ba67a8ccfc963fa009d
Gitweb: http://syslinux.zytor.com/commit/88f16f147237ab25ffd83ba67a8ccfc963fa009d
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 4 Feb 2010 18:15:25 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 4 Feb 2010 18:15:25 -0800
fs: generic handling of single dot (.) in disk-based filesystems
Single dot (.) support is useful to have for readdir. In some
filesystems we get it for free, but not in others. Either way, handle
it generically.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
core/fs.c | 49 ++++++++++++++++++++++++++-----------------------
1 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/core/fs.c b/core/fs.c
index 3d6652d..0eac0f2 100644
--- a/core/fs.c
+++ b/core/fs.c
@@ -175,37 +175,40 @@ void searchdir(com32sys_t *regs)
while (*name) {
p = part;
- while(*name && *name != '/')
+ while (*name && *name != '/')
*p++ = *name++;
*p = '\0';
- inode = this_fs->fs_ops->iget(part, parent);
- if (!inode)
- goto err;
- if (inode->mode == I_SYMLINK) {
- if (!this_fs->fs_ops->follow_symlink ||
- --symlink_count == 0 || /* limit check */
- inode->size >= BLOCK_SIZE(this_fs))
+ if (strcmp(part, ".")) {
+ inode = this_fs->fs_ops->iget(part, parent);
+ if (!inode)
goto err;
- name = this_fs->fs_ops->follow_symlink(inode, name);
- free_inode(inode);
- continue;
- }
-
- /*
- * For the relative path searching used in FAT and ISO fs.
- */
- if ((this_fs->fs_ops->fs_flags & FS_THISIND) && (this_inode != parent)){
+ if (inode->mode == I_SYMLINK) {
+ if (!this_fs->fs_ops->follow_symlink ||
+ --symlink_count == 0 || /* limit check */
+ inode->size >= BLOCK_SIZE(this_fs))
+ goto err;
+ name = this_fs->fs_ops->follow_symlink(inode, name);
+ free_inode(inode);
+ continue;
+ }
+
+ /*
+ * For the relative path searching used in FAT and ISO fs.
+ */
+ if ((this_fs->fs_ops->fs_flags & FS_THISIND) &&
+ (this_inode != parent)){
if (this_inode)
free_inode(this_inode);
this_inode = parent;
+ }
+
+ if (parent != this_inode)
+ free_inode(parent);
+ parent = inode;
}
-
- if (parent != this_inode)
- free_inode(parent);
- parent = inode;
- if (! *name)
+ if (!*name)
break;
- while(*name == '/')
+ while (*name == '/')
name++;
}
More information about the Syslinux-commits
mailing list