diff options
-rw-r--r-- | rtl/emx/sysdir.inc | 16 | ||||
-rw-r--r-- | rtl/os2/sysdir.inc | 4 |
2 files changed, 18 insertions, 2 deletions
diff --git a/rtl/emx/sysdir.inc b/rtl/emx/sysdir.inc index f69f7db6ed..2b790f4c5f 100644 --- a/rtl/emx/sysdir.inc +++ b/rtl/emx/sysdir.inc @@ -112,6 +112,8 @@ begin if Len > 2 then begin DoDirSeparators (S); + if (S [Pred (Len)] = DirectorySeparator) and (Len <> 3) then + S [Pred (Len)] := #0; RC := DosSetCurrentDir (S); if RC <> 0 then begin @@ -123,6 +125,8 @@ begin else begin DoDirSeparators (S); + if (Len > 1) and (S [Pred (Len)] = DirectorySeparator) then + S [Pred (Len)] := #0; RC := DosSetCurrentDir (S); if RC <> 0 then begin @@ -150,14 +154,22 @@ begin @LCHDIR: end ['eax','edx','esi']; if (Len > 2) and (InOutRes <> 0) then + begin + if (S [Pred (Len)] in AllowDirectorySeparators) and (Len <> 3) then + S [Pred (Len)] := #0; { Under EMX 0.9d DOS this routine may sometime } { fail or crash the system. } - DosDir ($3B, S); + DosDir ($3B, S); + end; end else + begin + if (Len > 1) and (S [Pred (Len)] in AllowDirectorySeparators) then + S [Pred (Len)] := #0; { Under EMX 0.9d DOS this routine may sometime } { fail or crash the system. } - DosDir ($3B, S); + DosDir ($3B, S); + end; end; diff --git a/rtl/os2/sysdir.inc b/rtl/os2/sysdir.inc index 1476f17083..f8912ca734 100644 --- a/rtl/os2/sysdir.inc +++ b/rtl/os2/sysdir.inc @@ -69,6 +69,8 @@ begin if Len > 2 then begin DoDirSeparators (s); + if (S [Pred (Len)] = DirectorySeparator) and (Len <> 3) then + S [Pred (Len)] := #0; RC := DosSetCurrentDir (s); if RC <> 0 then begin @@ -78,6 +80,8 @@ begin end; end else begin DoDirSeparators (s); + if (Len > 1) and (S [Pred (Len)] = DirectorySeparator) then + S [Pred (Len)] := #0; RC := DosSetCurrentDir (s); if RC <> 0 then begin |