From e9aed5bf5c3296f35ff7007cb1702c07b7dc2b37 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 21 Jun 2014 16:05:00 -0500 Subject: [PATCH 1/1] win32_capture.c: Don't add duplicate backslashes --- src/win32_capture.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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, -- 2.43.0