mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 10:49:33 +01:00
* Ansistring versions of MkDir,ChDir,RmDir: make a full copy of argument string. This is necessary because underlying implementations can modify directory separators in argument, causing crash if argument resides in read-only memory. This is also consistent with shortstring variants of same procedures.
git-svn-id: trunk@23000 -
This commit is contained in:
parent
2c011312db
commit
186cbaaf18
@ -88,9 +88,9 @@ Var
|
||||
{$endif FPC_HAS_FEATURE_COMMANDARGS}
|
||||
|
||||
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
||||
Procedure MkDir(const s:ansistring);overload;
|
||||
Procedure RmDir(const s:ansistring);overload;
|
||||
Procedure ChDir(const s:ansistring);overload;
|
||||
Procedure MkDir(s:ansistring);overload;
|
||||
Procedure RmDir(s:ansistring);overload;
|
||||
Procedure ChDir(s:ansistring);overload;
|
||||
{$endif FPC_HAS_FEATURE_FILEIO}
|
||||
|
||||
{****************************************************************************
|
||||
@ -245,18 +245,24 @@ end;
|
||||
|
||||
|
||||
{$ifdef FPC_HAS_FEATURE_FILEIO}
|
||||
Procedure MkDir(const s:ansistring);[IOCheck];
|
||||
{ xxDirPChar procedures can adjust directory separators in supplied string (at least
|
||||
Windows implementation does so). Therefore full copy of argument is needed,
|
||||
just passing by value isn't enough because it won't copy a string literal. }
|
||||
Procedure MkDir(s:ansistring);[IOCheck];
|
||||
begin
|
||||
UniqueString(s);
|
||||
mkdirpchar(pchar(s),length(s));
|
||||
end;
|
||||
|
||||
Procedure RmDir(const s:ansistring);[IOCheck];
|
||||
Procedure RmDir(s:ansistring);[IOCheck];
|
||||
begin
|
||||
UniqueString(s);
|
||||
RmDirpchar(pchar(s),length(s));
|
||||
end;
|
||||
|
||||
Procedure ChDir(const s:ansistring);[IOCheck];
|
||||
Procedure ChDir(s:ansistring);[IOCheck];
|
||||
begin
|
||||
UniqueString(s);
|
||||
ChDirpchar(pchar(s),length(s));
|
||||
end;
|
||||
{$endif FPC_HAS_FEATURE_FILEIO}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user