From: Eric Biggers Date: Sat, 21 Jun 2014 21:05:00 +0000 (-0500) Subject: win32_capture.c: Don't add duplicate backslashes X-Git-Tag: v1.7.1~90 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=e9aed5bf5c3296f35ff7007cb1702c07b7dc2b37;hp=028300650d936240c6d3a4da4fb30da62dd44692 win32_capture.c: Don't add duplicate backslashes --- diff --git a/src/win32_capture.c b/src/win32_capture.c index 30dc3ef5..7a836a5b 100644 --- a/src/win32_capture.c +++ b/src/win32_capture.c @@ -406,11 +406,18 @@ winnt_recurse_directory(HANDLE h, info->FileName[1] == L'.')) { wchar_t *p; + wchar_t *filename; struct wim_dentry *child; p = full_path + full_path_nchars; - *p++ = L'\\'; - p = wmempcpy(p, info->FileName, + /* Only add a backslash if we don't already have + * one. This prevents a duplicate backslash + * from being added when the path to the capture + * dir had a trailing backslash. */ + if (*(p - 1) != L'\\') + *p++ = L'\\'; + filename = p; + p = wmempcpy(filename, info->FileName, info->FileNameLength / 2); *p = '\0'; @@ -419,7 +426,7 @@ winnt_recurse_directory(HANDLE h, h, full_path, p - full_path, - full_path + full_path_nchars + 1, + filename, info->FileNameLength / 2, params, stats,