summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-04-07 16:39:15 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-04-07 16:41:00 -0700
commiteccab1fd22cc882836bdd34c14ff604409a01d1f (patch)
tree252ba16070f6eee2c48371418f1e469419523159
parent0a529352702e1f63786a99119b589a7ca7ce24ab (diff)
downloadsyslinux-eccab1fd22cc882836bdd34c14ff604409a01d1f.tar.gz
extlinux: Correct the directory block end conditionsyslinux-3.63-pre3
ext2/3 directory blocks are *not* ended with inode == 0; that reflects a deleted block (like 0xe5 in FAT.) Directory blocks are ended by directory block exhaustion; the last block is simply made as large as the whole directory block.
-rw-r--r--extlinux.asm16
1 files changed, 12 insertions, 4 deletions
diff --git a/extlinux.asm b/extlinux.asm
index 8b2eff5b..c96e1102 100644
--- a/extlinux.asm
+++ b/extlinux.asm
@@ -1116,25 +1116,32 @@ searchdir:
jmp .skipslash
.readdir:
+ mov cx,[SecPerClust]
+ push cx
+ shl cx,SECTOR_SHIFT
mov bx,trackbuf
+ add cx,bx
+ mov [EndBlock],cx
+ pop cx
push bx
- mov cx,[SecPerClust]
call getfssec
pop bx
pushf ; Save EOF flag
push si ; Save filesystem pointer
.getent:
- cmp dword [bx+d_inode],0
- je .endblock
+ cmp bx,[EndBlock]
+ jae .endblock
push di
+ cmp dword [bx+d_inode],0 ; Zero inode = void entry
+ je .nope
+
movzx cx,byte [bx+d_name_len]
lea si,[bx+d_name]
repe cmpsb
je .maybe
.nope:
pop di
-
add bx,[bx+d_rec_len]
jmp .getent
@@ -1232,6 +1239,7 @@ SymlinkBuf resb SYMLINK_SECTORS*SECTOR_SIZE+64
SymlinkTmpBuf equ trackbuf
SymlinkTmpBufEnd equ trackbuf+SYMLINK_SECTORS*SECTOR_SIZE+64
ThisDir resd 1
+EndBlock resw 1
SymlinkCtr resb 1
section .text