The SYSLINUX internal API closes a file automatically upon reading
to block EOF (not necessarily file EOF!) Thus, it's fairly likely
we'll get SI == 0 (closed file) passed to close_file at some point
or another.
Just plain admit it, and make close_file accept SI == 0 by spec.
;
comapi_close:
mov si,P_SI
- and si,si
- jz .nothing
call close_file
-.nothing:
clc
ret
; Assumes CS == DS.
;
close_file:
+ and si,si
+ jz .closed
mov dword [si],0 ; First dword == file_left
- ret
+.closed: ret
;
; searchdir:
push si
mov bx,[CurrentGetC]
mov si,[bx+gc_file]
- and si,si
- jz .closed
-.closed:
call close_file
add bx,getc_file_size
mov [CurrentGetC],bx
; Assumes CS == DS.
;
close_file:
+ and si,si
+ jz .closed
mov dword [si],0 ; First dword == file_left
- ret
+.closed: ret
;
; searchdir:
; Assumes CS == DS.
;
close_file:
+ and si,si
+ jz .closed
mov dword [si],0 ; First dword == file_left
- ret
+.closed: ret
;
; searchdir:
; side and send a courtesy ERROR packet to the server.
;
close_file:
+ and si,si
+ jz .closed
mov word [si],0 ; Not in use
- ret
+.closed: ret
;
; searchdir: