summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2014-02-03 22:34:56 +0000
committermarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2014-02-03 22:34:56 +0000
commit9cba398c77d0bdac84252e5836422111d69b4f86 (patch)
tree467809e3f753792cbfbc4523bccbb8381d714018
parent06d8b8fc12d2df8ece163de9ef8a95ba935d365b (diff)
downloadfpc-9cba398c77d0bdac84252e5836422111d69b4f86.tar.gz
* committed Tomas' patch
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/fixes_2_6@26668 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--rtl/emx/sysdir.inc16
-rw-r--r--rtl/os2/sysdir.inc4
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