* do_open checks for directory, if directory then ioerror 2

This commit is contained in:
peter 2000-07-08 18:02:39 +00:00
parent d2975fe115
commit 4ddd970c7e
2 changed files with 34 additions and 9 deletions

View File

@ -220,6 +220,15 @@ begin
end;
Function Sys_fstat(fd : longint;var Info:stat):Longint;
var
regs : SysCallregs;
begin
regs.reg2:=fd;
regs.reg3:=longint(@Info);
Sys_fStat:=SysCall(SysCall_nr_fstat,regs);
end;
Function Sys_Rename(Oldname,Newname:pchar):longint;
var
@ -389,7 +398,10 @@ end;
{
$Log$
Revision 1.10 2000-02-09 16:59:32 peter
Revision 1.11 2000-07-08 18:02:39 peter
* do_open checks for directory, if directory then ioerror 2
Revision 1.10 2000/02/09 16:59:32 peter
* truncated log
Revision 1.9 2000/02/08 11:47:09 peter

View File

@ -352,6 +352,7 @@ Procedure Do_Open(var f;p:pchar;flags:longint);
}
var
oflags : longint;
dirtest : stat;
Begin
{ close first if opened }
if ((flags and $10000)=0) then
@ -412,6 +413,15 @@ Begin
Oflags:=Oflags and not(Open_RDWR);
FileRec(f).Handle:=sys_open(p,oflags,438);
end;
{ Check if it's a directory, then we should return io error 2 }
if ErrNo=0 then
begin
if (Sys_fstat(filerec(f).handle,dirtest)<>0) then
inoutres:=2
else
if (dirtest.mode and STAT_IFMT)<>STAT_IFREG then
inoutres:=2;
end;
Errno2Inoutres;
End;
@ -783,7 +793,10 @@ End.
{
$Log$
Revision 1.48 2000-06-30 22:14:03 peter
Revision 1.49 2000-07-08 18:02:39 peter
* do_open checks for directory, if directory then ioerror 2
Revision 1.48 2000/06/30 22:14:03 peter
* removed obsolete crtlib code
* support EINTR for read/write to restart the syscall