Skip to contentSkip to conversation

Fix path normalization for SMB shares

PATCH New Orgad Shaneh 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix path normalization for SMB shares

SMB shared are accessed using //server/share/directory... notation.

normalize_path_copy used to leave only a single slash, which invalidated the path.

Fix suggested by Nguyen Thai Ngoc Duy

---
 path.c |    6 ++++++
 1 file changed, 6 insertions(+)
path.c +6 -0
index 66acd24..6cd9c0b 100644
@@ -503,6 +503,12 @@ int normalize_path_copy(char *dst, const char *src)
 		*dst++ = *src++;
 		*dst++ = *src++;
 	}
+#ifdef WIN32
+	else if (is_dir_sep(src[0]) && is_dir_sep(src[1])) {
+		*dst++ = '/';
+		src++;
+	}
+#endif
 	dst0 = dst;
 
 	if (is_dir_sep(*src)) {
Signature · 1 line
1.7.10.4