From 5990ba67725b1e0614b2362c4408085d5bf5bfc9 Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Sun, 15 Aug 2010 21:41:43 +0000 Subject: [PATCH] libini: abort infinite loop on write error git-svn-id: svn://kolibrios.org@1568 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/libs-dev/.test/001/test001.asm | 2 +- .../develop/libraries/libs-dev/libini/libini_p.asm | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/programs/develop/libraries/libs-dev/.test/001/test001.asm b/programs/develop/libraries/libs-dev/.test/001/test001.asm index b7c7cd6670..7090a683c4 100644 --- a/programs/develop/libraries/libs-dev/.test/001/test001.asm +++ b/programs/develop/libraries/libs-dev/.test/001/test001.asm @@ -396,7 +396,7 @@ import libgfx, \ gfx.open ,'gfx_open',\ gfx.close ,'gfx_close',\ gfx.pen.color ,'gfx_pen_color',\ - gfx.brush.color ,'gfx_brush.color',\ + gfx.brush.color ,'gfx_brush_color',\ gfx.pixel ,'gfx_pixel',\ gfx.move.to ,'gfx_move_to',\ gfx.line.to ,'gfx_line_to',\ diff --git a/programs/develop/libraries/libs-dev/libini/libini_p.asm b/programs/develop/libraries/libs-dev/libini/libini_p.asm index d358dae76c..db6f2737ed 100644 --- a/programs/develop/libraries/libs-dev/libini/libini_p.asm +++ b/programs/develop/libraries/libs-dev/libini/libini_p.asm @@ -278,8 +278,15 @@ endl neg eax sub eax, ecx invoke file.seek, ebx, eax, SEEK_CUR + push ecx invoke file.write, ebx, [buf], ecx - jmp @b + pop ecx + cmp eax, ecx + jz @b + .fail: + or eax, -1 + pop ecx ebx + ret .done: mov eax, [_delta] neg eax @@ -290,10 +297,6 @@ endl pop ecx ebx .skip: ret - .fail: - or eax, -1 - pop ecx ebx - ret .down: neg [_delta]