From fdad5bfed32e10dc75a5c3b5b7c2a12e6eef062e Mon Sep 17 00:00:00 2001 From: CleverMouse Date: Fri, 21 Dec 2012 19:26:30 +0000 Subject: [PATCH] revert libio-related changes from r3130 and do the fix in the correct place git-svn-id: svn://kolibrios.org@3131 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/libs-dev/libini/libini.asm | 17 ++++++++++++----- .../develop/libraries/libs-dev/libio/libio.asm | 6 ------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/programs/develop/libraries/libs-dev/libini/libini.asm b/programs/develop/libraries/libs-dev/libini/libini.asm index e48cf15ee3..e7b7663880 100644 --- a/programs/develop/libraries/libs-dev/libini/libini.asm +++ b/programs/develop/libraries/libs-dev/libini/libini.asm @@ -104,7 +104,7 @@ endl mov [f.buf], eax invoke file.open, [_f_name], O_READ cmp eax, 32 - jb .exit_error + jb .exit_file_error mov [f.fh], eax invoke mem.alloc, ini.MEM_SIZE or eax, eax @@ -162,6 +162,7 @@ endl .exit_error: invoke file.close, [f.fh] invoke mem.free, [f.buf] + .exit_file_error: invoke mem.free, [sec_buf] .exit_error.2: or eax, -1 @@ -209,7 +210,7 @@ endl mov [f.buf], eax invoke file.open, [_f_name], O_READ cmp eax, 32 - jb .exit_error + jb .exit_file_error mov [f.fh], eax invoke mem.alloc, ini.MEM_SIZE or eax, eax @@ -262,6 +263,7 @@ endl .exit_error: invoke file.close, [f.fh] invoke mem.free, [f.buf] + .exit_file_error: invoke mem.free, [val_buf] .exit_error.2: invoke mem.free, [key_buf] @@ -298,7 +300,7 @@ endl mov [f.buf], eax invoke file.open, [_f_name], O_READ cmp eax, 32 - jb .exit_error + jb .exit_file_error mov [f.fh], eax invoke mem.alloc, ini.MEM_SIZE or eax, eax @@ -324,6 +326,7 @@ endl .exit_error: invoke file.close, [f.fh] invoke mem.free, [f.buf] + .exit_file_error: mov edi, [_buffer] mov esi, [_def_val] xor al, al @@ -364,7 +367,7 @@ endl mov [f.buf], eax invoke file.open, [_f_name], O_READ + O_WRITE + O_CREATE cmp eax, 32 - jb .exit_error + jb .exit_file_error mov [f.fh], eax invoke mem.alloc, ini.MEM_SIZE or eax, eax @@ -392,6 +395,7 @@ endl invoke file.seek, [f.fh], eax, SEEK_SET invoke file.write, [f.fh], [_buffer], [_buf_len] + invoke file.close, [f.fh] pop edi esi ebx xor eax, eax ret @@ -437,6 +441,8 @@ endl jmp .create_key.ex .exit_error: + invoke file.close, [f.fh] + .exit_file_error: pop edi esi ebx or eax, -1 ret @@ -466,7 +472,7 @@ endl mov [f.buf], eax invoke file.open, [_f_name], O_READ cmp eax, 32 - jb .exit_error + jb .exit_file_error mov [f.fh], eax invoke mem.alloc, ini.MEM_SIZE or eax, eax @@ -514,6 +520,7 @@ endl .exit_error: invoke file.close, [f.fh] + .exit_file_error: invoke mem.free, [f.buf] mov eax, [_def_val] pop edi esi ebx edx diff --git a/programs/develop/libraries/libs-dev/libio/libio.asm b/programs/develop/libraries/libs-dev/libio/libio.asm index 2054fa692b..4224e34f76 100644 --- a/programs/develop/libraries/libs-dev/libio/libio.asm +++ b/programs/develop/libraries/libs-dev/libio/libio.asm @@ -512,17 +512,11 @@ proc file.close _filed ;//////////////////////////////////////////////////////// ;;------------------------------------------------------------------------------------------------;; ;# call `file.err` to obtain extended error information ;; ;;================================================================================================;; - cmp eax,32 - jb .exit_error mov eax, [_filed] mov [eax + InternalFileInfo.Mode], 0 mov [eax + InternalFileInfo.FileName], 0 invoke mem.free, eax xor eax, eax - jmp @f - .exit_error: - or eax, -1 - @@: ret endp