fix chdir with no trailing slash

This commit is contained in:
Dave Murphy
2009-11-02 12:38:25 +00:00
parent 9b4510f9e9
commit 6a7b0f4cb8
2 changed files with 5 additions and 4 deletions

View File

@@ -710,7 +710,7 @@ diff -Nbaur newlib-1.17.0/libgloss/libsysbase/build_argv.c newlib-1.17.0-arm/lib
+ argstruct->endARGV = &argv[argCount];
+}
diff -Nbaur newlib-1.17.0/libgloss/libsysbase/chdir.c newlib-1.17.0-arm/libgloss/libsysbase/chdir.c
--- newlib-1.17.0/libgloss/libsysbase/chdir.c 1970-01-01 01:00:00.000000000 +0100
--- newlib-1.17.0/libgloss/libsysbase/chdir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.17.0-arm/libgloss/libsysbase/chdir.c 2009-11-02 11:27:24.000000000 +0000
@@ -0,0 +1,176 @@
+#include <unistd.h>
@@ -743,7 +743,6 @@ diff -Nbaur newlib-1.17.0/libgloss/libsysbase/chdir.c newlib-1.17.0-arm/libgloss
+ pathEnd = path + pathLength;
+ if (pathEnd[-1] != DIRECTORY_SEPARATOR_CHAR) {
+ pathEnd[0] = DIRECTORY_SEPARATOR_CHAR;
+ pathEnd += 1;
+ pathEnd += 1;
+ }
+
@@ -810,6 +809,7 @@ diff -Nbaur newlib-1.17.0/libgloss/libsysbase/chdir.c newlib-1.17.0-arm/libgloss
+ } while (extraSize != 0);
+
+ if (pathEnd[-1] != DIRECTORY_SEPARATOR_CHAR) {
+ pathEnd[0] = DIRECTORY_SEPARATOR_CHAR;
+ pathEnd[1] = 0;
+ pathEnd += 1;
+ }

View File

@@ -5562,8 +5562,8 @@ diff -Nbaur newlib-1.17.1/libgloss/libsysbase/build_argv.c newlib-1.17.1-ppc/lib
+}
diff -Nbaur newlib-1.17.1/libgloss/libsysbase/chdir.c newlib-1.17.1-ppc/libgloss/libsysbase/chdir.c
--- newlib-1.17.1/libgloss/libsysbase/chdir.c 1970-01-01 01:00:00.000000000 +0100
+++ newlib-1.17.1-ppc/libgloss/libsysbase/chdir.c 2009-06-16 23:32:27.000000000 +0100
@@ -0,0 +1,175 @@
+++ newlib-1.17.1-ppc/libgloss/libsysbase/chdir.c 2009-11-02 00:26:41.000000000 +0000
@@ -0,0 +1,176 @@
+#include <unistd.h>
+#include <reent.h>
+#include <string.h>
@@ -5661,6 +5661,7 @@ diff -Nbaur newlib-1.17.1/libgloss/libsysbase/chdir.c newlib-1.17.1-ppc/libgloss
+
+ if (pathEnd[-1] != DIRECTORY_SEPARATOR_CHAR) {
+ pathEnd[0] = DIRECTORY_SEPARATOR_CHAR;
+ pathEnd[1] = 0;
+ pathEnd += 1;
+ }
+