diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-04 18:15:25 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-04 18:15:25 -0800 |
commit | 88f16f147237ab25ffd83ba67a8ccfc963fa009d (patch) | |
tree | bee0bae37055a53649c8cbeaaf5b941ffe8a62e4 | |
parent | 09fc871d0b691fffb846b4c49869a949fa776108 (diff) | |
download | syslinux-88f16f147237ab25ffd83ba67a8ccfc963fa009d.tar.gz |
fs: generic handling of single dot (.) in disk-based filesystemssyslinux-4.00-pre16
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@zytor.com>
-rw-r--r-- | core/fs.c | 49 |
1 files changed, 26 insertions, 23 deletions
@@ -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++; } |