mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 08:10:24 +01:00
* do_open checks for directory, if directory then ioerror 2
This commit is contained in:
parent
d2975fe115
commit
4ddd970c7e
@ -220,6 +220,15 @@ begin
|
|||||||
end;
|
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;
|
Function Sys_Rename(Oldname,Newname:pchar):longint;
|
||||||
var
|
var
|
||||||
@ -389,7 +398,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* truncated log
|
||||||
|
|
||||||
Revision 1.9 2000/02/08 11:47:09 peter
|
Revision 1.9 2000/02/08 11:47:09 peter
|
||||||
|
|||||||
@ -352,6 +352,7 @@ Procedure Do_Open(var f;p:pchar;flags:longint);
|
|||||||
}
|
}
|
||||||
var
|
var
|
||||||
oflags : longint;
|
oflags : longint;
|
||||||
|
dirtest : stat;
|
||||||
Begin
|
Begin
|
||||||
{ close first if opened }
|
{ close first if opened }
|
||||||
if ((flags and $10000)=0) then
|
if ((flags and $10000)=0) then
|
||||||
@ -412,6 +413,15 @@ Begin
|
|||||||
Oflags:=Oflags and not(Open_RDWR);
|
Oflags:=Oflags and not(Open_RDWR);
|
||||||
FileRec(f).Handle:=sys_open(p,oflags,438);
|
FileRec(f).Handle:=sys_open(p,oflags,438);
|
||||||
end;
|
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;
|
Errno2Inoutres;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -783,7 +793,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* removed obsolete crtlib code
|
||||||
* support EINTR for read/write to restart the syscall
|
* support EINTR for read/write to restart the syscall
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user