From bcbb21839ded43fa86ba2f26a82ffc329f5d094f Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 20 Feb 2001 21:31:12 +0000 Subject: [PATCH] * chdir,mkdir,rmdir with empty string fixed --- rtl/go32v2/system.pp | 11 +++++++---- rtl/os2/system.pas | 16 ++++++++++------ rtl/unix/sysunix.inc | 14 ++++++++++---- rtl/win32/system.pp | 30 ++++++++++++++++++------------ 4 files changed, 45 insertions(+), 26 deletions(-) diff --git a/rtl/go32v2/system.pp b/rtl/go32v2/system.pp index 9ea7527551..c4ef3f93bb 100644 --- a/rtl/go32v2/system.pp +++ b/rtl/go32v2/system.pp @@ -1237,7 +1237,7 @@ end; procedure mkdir(const s : string);[IOCheck]; begin - If InOutRes <> 0 then + If (s='') or (InOutRes <> 0) then exit; DosDir($39,s); end; @@ -1245,7 +1245,7 @@ end; procedure rmdir(const s : string);[IOCheck]; begin - If InOutRes <> 0 then + If (s='') or (InOutRes <> 0) then exit; DosDir($3a,s); end; @@ -1255,7 +1255,7 @@ procedure chdir(const s : string);[IOCheck]; var regs : trealregs; begin - If InOutRes <> 0 then + If (s='') or (InOutRes <> 0) then exit; { First handle Drive changes } if (length(s)>=2) and (s[2]=':') then @@ -1417,7 +1417,10 @@ Begin End. { $Log$ - Revision 1.3 2000-08-13 19:23:26 peter + Revision 1.4 2001-02-20 21:31:12 peter + * chdir,mkdir,rmdir with empty string fixed + + Revision 1.3 2000/08/13 19:23:26 peter * fixed double declared ___exit() (merged) Revision 1.2 2000/07/13 11:33:40 michael diff --git a/rtl/os2/system.pas b/rtl/os2/system.pas index 8f6237ee1f..70467dd974 100644 --- a/rtl/os2/system.pas +++ b/rtl/os2/system.pas @@ -689,7 +689,8 @@ end; procedure MkDir (const S: string); begin - if InOutRes = 0 then + If (s='') or (InOutRes <> 0) then + exit; DosDir ($39, S); end; @@ -697,7 +698,8 @@ end; procedure rmdir(const s : string); begin - if InOutRes = 0 then + If (s='') or (InOutRes <> 0) then + exit; DosDir ($3A, S); end; @@ -709,8 +711,8 @@ var RC: longint; Buffer: array [0..255] of char; begin - if InOutRes = 0 then - begin + If (s='') or (InOutRes <> 0) then + exit; (* According to EMX documentation, EMX has only one current directory for all processes, so we'll use native calls under OS/2. *) if os_Mode = osOS2 then @@ -765,7 +767,6 @@ begin end else DosDir ($3B, S); - end; end; {$ASMMODE ATT} @@ -948,7 +949,10 @@ begin end. { $Log$ - Revision 1.7 2001-02-04 01:57:52 hajny + Revision 1.8 2001-02-20 21:31:12 peter + * chdir,mkdir,rmdir with empty string fixed + + Revision 1.7 2001/02/04 01:57:52 hajny * direct asm removing Revision 1.6 2001/02/01 21:30:01 hajny diff --git a/rtl/unix/sysunix.inc b/rtl/unix/sysunix.inc index a2e3379d44..73fe62d063 100644 --- a/rtl/unix/sysunix.inc +++ b/rtl/unix/sysunix.inc @@ -447,7 +447,8 @@ Procedure MkDir(Const s: String);[IOCheck]; Var Buffer: Array[0..255] of Char; Begin - If InOutRes <> 0 then exit; + If (s='') or (InOutRes <> 0) then + exit; Move(s[1], Buffer, Length(s)); Buffer[Length(s)] := #0; sys_mkdir(@buffer, 511); @@ -459,7 +460,8 @@ Procedure RmDir(Const s: String);[IOCheck]; Var Buffer: Array[0..255] of Char; Begin - If InOutRes <> 0 then exit; + If (s='') or (InOutRes <> 0) then + exit; Move(s[1], Buffer, Length(s)); Buffer[Length(s)] := #0; sys_rmdir(@buffer); @@ -471,7 +473,8 @@ Procedure ChDir(Const s: String);[IOCheck]; Var Buffer: Array[0..255] of Char; Begin - If InOutRes <> 0 then exit; + If (s='') or (InOutRes <> 0) then + exit; Move(s[1], Buffer, Length(s)); Buffer[Length(s)] := #0; sys_chdir(@buffer); @@ -743,7 +746,10 @@ End. { $Log$ - Revision 1.4 2000-12-17 14:00:57 peter + Revision 1.5 2001-02-20 21:31:12 peter + * chdir,mkdir,rmdir with empty string fixed + + Revision 1.4 2000/12/17 14:00:57 peter * removed debug writelns Revision 1.3 2000/10/09 16:35:51 marco diff --git a/rtl/win32/system.pp b/rtl/win32/system.pp index b55d5c32c7..782f51d26b 100644 --- a/rtl/win32/system.pp +++ b/rtl/win32/system.pp @@ -615,27 +615,30 @@ begin end; function CreateDirectoryTrunc(name:pointer):word; - begin +begin CreateDirectoryTrunc:=CreateDirectory(name,nil); - end; +end; procedure mkdir(const s:string);[IOCHECK]; - begin - If InOutRes <> 0 then exit; +begin + If (s='') or (InOutRes <> 0) then + exit; dirfn(TDirFnType(@CreateDirectoryTrunc),s); - end; +end; procedure rmdir(const s:string);[IOCHECK]; - begin - If InOutRes <> 0 then exit; +begin + If (s='') or (InOutRes <> 0) then + exit; dirfn(TDirFnType(@RemoveDirectory),s); - end; +end; procedure chdir(const s:string);[IOCHECK]; - begin - If InOutRes <> 0 then exit; +begin + If (s='') or (InOutRes <> 0) then + exit; dirfn(TDirFnType(@SetCurrentDirectory),s); - end; +end; procedure getdir(drivenr:byte;var dir:shortstring); const @@ -1423,7 +1426,10 @@ end. { $Log$ - Revision 1.5 2001-01-26 16:38:03 florian + Revision 1.6 2001-02-20 21:31:12 peter + * chdir,mkdir,rmdir with empty string fixed + + Revision 1.5 2001/01/26 16:38:03 florian *** empty log message *** Revision 1.4 2001/01/24 21:47:38 florian