Browse Source

* chdir,mkdir,rmdir with empty string fixed

peter 24 years ago
parent
commit
bcbb21839d
4 changed files with 45 additions and 26 deletions
  1. 7 4
      rtl/go32v2/system.pp
  2. 10 6
      rtl/os2/system.pas
  3. 10 4
      rtl/unix/sysunix.inc
  4. 18 12
      rtl/win32/system.pp

+ 7 - 4
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

+ 10 - 6
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

+ 10 - 4
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

+ 18 - 12
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