mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
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>
This commit is contained in:
parent
2fd20cfd85
commit
abf18f42dc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user