* fixed setting EInoutError.ErrorCode (mantis #12575, thanks to

Bart Broersma for the analysis)

git-svn-id: trunk@12037 -
This commit is contained in:
Jonas Maebe 2008-11-09 09:46:47 +00:00
parent 718694d1d6
commit dbbd75ca47
3 changed files with 26 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8613,6 +8613,7 @@ tests/webtbs/tw1250.pp svneol=native#text/plain
tests/webtbs/tw12508a.pp svneol=native#text/plain tests/webtbs/tw12508a.pp svneol=native#text/plain
tests/webtbs/tw1251b.pp svneol=native#text/plain tests/webtbs/tw1251b.pp svneol=native#text/plain
tests/webtbs/tw1255.pp svneol=native#text/plain tests/webtbs/tw1255.pp svneol=native#text/plain
tests/webtbs/tw12575.pp svneol=native#text/plain
tests/webtbs/tw1269.pp svneol=native#text/plain tests/webtbs/tw1269.pp svneol=native#text/plain
tests/webtbs/tw1275.pp svneol=native#text/plain tests/webtbs/tw1275.pp svneol=native#text/plain
tests/webtbs/tw1279.pp svneol=native#text/plain tests/webtbs/tw1279.pp svneol=native#text/plain

View File

@ -284,7 +284,14 @@ begin
106 : HS:=@SInvalidInput; 106 : HS:=@SInvalidInput;
end; end;
E:=EinOutError.Create (HS^); E:=EinOutError.Create (HS^);
EInoutError(E).ErrorCode:=IOresult; // Clears InOutRes !! // this routine can be called from FPC_IOCHECK,
// which clears inoutres and then passes its
// original value to HandleErrorFrame() (which calls
// us). So use errno rather than IOResult, and clear
// InOutRes explicitly in case we can also be called
// from a place that does not clear InOutRes explicitly
EInoutError(E).ErrorCode:=errno;
inoutres:=0;
end; end;
// We don't set abstracterrorhandler, but we do it here. // We don't set abstracterrorhandler, but we do it here.
// Unless the use sets another handler we'll get here anyway... // Unless the use sets another handler we'll get here anyway...

17
tests/webtbs/tw12575.pp Normal file
View File

@ -0,0 +1,17 @@
{$mode objfpc}
PROGRAM Test;
USES SysUtils;
VAR
t : Text;
BEGIN
Assign(t, 'blah.txt');
TRY
Close(t);
EXCEPT
ON e: EInOutError DO
if (e.ErrorCode <> 103) then
halt(1);
END;
END.