mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 07:26:24 +02:00
* reenabled the old getdir code when fpgetcwd was not FPC_USE_LIBC. getcwd
syscalls can fail, specially on special file systems. git-svn-id: trunk@5262 -
This commit is contained in:
parent
d526a682d1
commit
ed5e73b9a3
@ -73,13 +73,15 @@ Begin
|
|||||||
InOutRes:=3;
|
InOutRes:=3;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{$define usegetcwd}
|
// !! for now we use getcwd, unless we are fpc_use_libc.
|
||||||
|
// !! the old code is _still needed_ since the syscall sometimes doesn't work
|
||||||
|
// !! on special filesystems like NFS etc.
|
||||||
|
// !! In the libc versions, the alt code is already integrated in the libc code.
|
||||||
|
// !! Also significantly boosted buffersize. This will make failure of the
|
||||||
|
// !! dos legacy api's better visibile due to cut-off path, instead of "empty"
|
||||||
procedure getdir(drivenr : byte;var dir : shortstring);
|
procedure getdir(drivenr : byte;var dir : shortstring);
|
||||||
var
|
var
|
||||||
{$ifdef usegetcwd}
|
buf : array[0..2047] of char;
|
||||||
buf : array[0..254] of char;
|
|
||||||
{$else}
|
|
||||||
cwdinfo : stat;
|
cwdinfo : stat;
|
||||||
rootinfo : stat;
|
rootinfo : stat;
|
||||||
thedir,dummy : string[255];
|
thedir,dummy : string[255];
|
||||||
@ -88,14 +90,14 @@ var
|
|||||||
name : string[255];
|
name : string[255];
|
||||||
thisdir : stat;
|
thisdir : stat;
|
||||||
tmp : string[255];
|
tmp : string[255];
|
||||||
{$endif}
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
dir:='';
|
dir:='';
|
||||||
{$ifdef usegetcwd}
|
|
||||||
if Fpgetcwd(@buf[0],sizeof(buf))<>nil then
|
if Fpgetcwd(@buf[0],sizeof(buf))<>nil then
|
||||||
dir:=strpas(buf);
|
dir:=strpas(buf)
|
||||||
{$else}
|
{$ifndef FPC_USE_LIBC}
|
||||||
|
else
|
||||||
|
begin
|
||||||
thedir:='';
|
thedir:='';
|
||||||
dummy:='';
|
dummy:='';
|
||||||
|
|
||||||
@ -147,6 +149,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
until false;
|
until false;
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user