* fixed the placement of some fileclose() calls

git-svn-id: trunk@12673 -
This commit is contained in:
Jonas Maebe 2009-02-03 13:22:37 +00:00
parent b1f3d5de97
commit 8a0c16edb6

View File

@ -99,16 +99,16 @@ begin
l2:=fileopen('tfile2.dat',fmopenread);
if (l2 >= 0) then
begin
fileclose(l2);
raise exception.create('opening two files as read-only without sharing specified succeeded (should not, file is by default locked)');
end;
fileclose(l2);
l2:=fileopen('tfile2.dat',fmopenread or fmShareDenyWrite);
if (l2 >= 0) then
begin
fileclose(l2);
raise exception.create('opening two files as read-only with fmShareDenyWrite succeeded (should not, file is by default locked)');
end;
fileclose(l);
fileclose(l2);
{ should be same as no locking specified }
@ -117,12 +117,16 @@ begin
raise exception.create('unable to open file in read-only mode (3)');
l2:=fileopen('tfile2.dat',fmopenread or fmShareCompat);
if (l2 >= 0) then
raise exception.create('opening two files as read-only with fmShareCompat succeeded (should be locked)');
fileclose(l2);
begin
fileclose(l2);
raise exception.create('opening two files as read-only with fmShareCompat succeeded (should be locked)');
end;
l2:=fileopen('tfile2.dat',fmopenread or fmShareDenyWrite);
if (l2 >= 0) then
raise exception.create('opening file first as read-only fmShareCompat (should not have any effect), and then again as fmopenread with fmShareDenyWrite succeeded');
fileclose(l2);
begin
fileclose(l2);
raise exception.create('opening file first as read-only fmShareCompat (should not have any effect), and then again as fmopenread with fmShareDenyWrite succeeded');
end;
fileclose(l);
@ -133,22 +137,21 @@ begin
if (l2 < 0) then
raise exception.create('opening two files as read-only with fmShareDenyNone failed');
fileclose(l2);
{ unix-specific that this fails? }
l2:=fileopen('tfile2.dat',fmopenread or fmShareDenyWrite);
if (l2 < 0) then
raise exception.create('opening two files as read-only with fmShareDenyNone and then fmShareDenyWrite failed');
fileclose(l2);
{ unix-specific that this fails? }
l2:=fileopen('tfile2.dat',fmopenread or fmShareExclusive);
if (l2 >= 0) then
raise exception.create('opening two files as read-only with fmShareDenyNone and then fmShareExclusive succeeded');
fileclose(l2);
begin
fileclose(l2);
raise exception.create('opening two files as read-only with fmShareDenyNone and then fmShareExclusive succeeded');
end;
fileclose(l);
l:=fileopen('tfile2.dat',fmopenread or fmShareDenyWrite);
if (l<0) then
raise exception.create('unable to open file in read-only mode and fmShareDenyWrite mode (2)');
{ unix-specific that this fails? }
l2:=fileopen('tfile2.dat',fmopenread or fmShareDenyNone);
if (l2 < 0) then
raise exception.create('opening files as read-only with fmShareDenyWrite and then fmShareDenyNone failed');
@ -172,7 +175,8 @@ begin
end;
end;
finally
fileclose(l);
if (l>=0) then
fileclose(l);
deletefile('tfile2.dat');
end;
end.