[PATCH] diff: strip trailing / on dirs
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Fri Jul 9 11:33:00 UTC 2010
On Fri, Jul 09, 2010 at 09:40:12AM +0000, Natanael Copa wrote:
>fixes #2203
>https://bugs.busybox.net/show_bug.cgi?id=2203
shouldn't this be more like
while ((lc = last_char_is(p[i], '/')) != NULL)
*lc = 0;
thanks,
>---
> editors/diff.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
>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. */
>--
>1.7.1.1
>
>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list