[Bug 2203] diff -r on a dir with trailing / goes bad

bugzilla at busybox.net bugzilla at busybox.net
Fri Jul 9 09:27:35 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2203

--- Comment #1 from Natanael Copa <natanael.copa at gmail.com>  ---
Possible fix. Might not solve the issue when one of the dirs is / (root).

diff --git a/editors/diff.c b/editors/diff.c
index 07594e8..e2da626 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -788,9 +788,15 @@ static void diffdir(char *p[2], const char *s_start)

     memset(&list, 0, sizeof(list));
     for (i = 0; i < 2; i++) {
+        char *lc;
         /*list[i].s = list[i].e = 0; - memset did it */
         /*list[i].dl = NULL; */

+        /* trim trailing / in dirs. */
+        lc = last_char_is(p[i], '/');
+        if (lc && lc != p[i])
+            *lc = '\0';
+
         /* We need to trim root directory prefix.
          * Using list.len to specify its length,
          * add_to_dirlist will remove it. */

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list