summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2016-08-17 10:49:50 -0700
committerStefan Metzmacher <metze@samba.org>2016-08-28 18:12:09 +0200
commite5baf884efeb443575857066c3b5c0d4d14548dd (patch)
tree0692af70cf1cc7b55d9ce35a998b052033894c0b /source3/modules
parent4b266772a33653cc79c7dd88d9c6012da3cd62da (diff)
downloadsamba-e5baf884efeb443575857066c3b5c0d4d14548dd.tar.gz
s3: vfs: shadow_copy2: Replace all uses of (p-name) with len_before_gmt.
p and name don't change, and we've already calculated this length. Part of the effort to make the code inside vfs_snapper.c that does the same thing more similar (we can't make these functions identical due to the 'snapdir' use case). BUG: https://bugzilla.samba.org/show_bug.cgi?id=12150 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org> (cherry picked from commit abf18f42dc398f5f17088de87fd0e681fd44ebeb)
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_shadow_copy2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 4ac16d3c10e..2a72740d729 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -514,7 +514,7 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
q += 1;
rest_len = strlen(q);
- dst_len = (p-name) + rest_len;
+ dst_len = len_before_gmt + rest_len;
if (priv->config->snapdirseverywhere) {
char *insert;
@@ -580,10 +580,10 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx,
return false;
}
if (p > name) {
- memcpy(stripped, name, p-name);
+ memcpy(stripped, name, len_before_gmt);
}
if (rest_len > 0) {
- memcpy(stripped + (p-name), q, rest_len);
+ memcpy(stripped + len_before_gmt, q, rest_len);
}
stripped[dst_len] = '\0';
*pstripped = stripped;