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>
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;
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;