[CABINET]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 26 Feb 2017 14:31:01 +0000 (14:31 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 26 Feb 2017 14:31:01 +0000 (14:31 +0000)
Fix handling of trailing backslash.
Patch by Thomas Faber.

ROSTESTS-135

svn path=/trunk/; revision=73926

reactos/dll/win32/cabinet/cabinet_ros.diff [new file with mode: 0644]
reactos/dll/win32/cabinet/fdi.c

diff --git a/reactos/dll/win32/cabinet/cabinet_ros.diff b/reactos/dll/win32/cabinet/cabinet_ros.diff
new file mode 100644 (file)
index 0000000..ed75081
--- /dev/null
@@ -0,0 +1,29 @@
+Index: fdi.c
+===================================================================
+--- fdi.c      (revision 73922)
++++ fdi.c      (working copy)
+@@ -2039,11 +2039,24 @@
+             fullpath[0] = '\0';
+             if (pathlen) {
+               strcpy(fullpath, userpath);
++#ifndef __REACTOS__
+               if (fullpath[pathlen - 1] != '\\')
+                 strcat(fullpath, "\\");
++#else
++              if (fullpath[pathlen - 1] == '\\')
++                fullpath[pathlen - 1] = '\0';
++#endif
+             }
++#ifndef __REACTOS__
+             if (filenamelen)
++#else
++            if (filenamelen) {
++              strcat(fullpath, "\\");
++#endif
+               strcat(fullpath, cab->mii.nextname);
++#ifdef __REACTOS__
++            }
++#endif
+             TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));
index 2ff5dd9..250ff1b 100644 (file)
@@ -2039,11 +2039,24 @@ static int fdi_decomp(const struct fdi_file *fi, int savemode, fdi_decomp_state
             fullpath[0] = '\0';
             if (pathlen) {
               strcpy(fullpath, userpath);
+#ifndef __REACTOS__
               if (fullpath[pathlen - 1] != '\\')
                 strcat(fullpath, "\\");
+#else
+              if (fullpath[pathlen - 1] == '\\')
+                fullpath[pathlen - 1] = '\0';
+#endif
             }
+#ifndef __REACTOS__
             if (filenamelen)
+#else
+            if (filenamelen) {
+              strcat(fullpath, "\\");
+#endif
               strcat(fullpath, cab->mii.nextname);
+#ifdef __REACTOS__
+            }
+#endif
 
             TRACE("full cab path/file name: %s\n", debugstr_a(fullpath));