From: Jeremy Allison Date: Wed, 17 Aug 2016 17:49:50 +0000 (-0700) Subject: s3: vfs: shadow_copy2: Replace all uses of (p-name) with len_before_gmt. X-Git-Tag: tevent-0.9.30~78 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=abf18f42dc398f5f17088de87fd0e681fd44ebeb;p=samba.git 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 Reviewed-by: Christof Schmitt Reviewed-by: David Disseldorp --- 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;