From b8c11dbfd1d408c949e7bf71bd2687aef8267ffc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 11 Apr 2017 12:03:52 +0200 Subject: s3:vfs:shadow_copy2: fix corner case of "/@GMT-token" in shadow_copy2_strip_snapshot Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison (cherry picked from commit 26661218b3d3f0d4ee89039727bc110e972c2851) The last 3 patches address BUG: https://bugzilla.samba.org/show_bug.cgi?id=12743 vfs_shadow_copy2 fails to list snapshots from shares with GlusterFS backend --- source3/modules/vfs_shadow_copy2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/modules') diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 83be84e50a8..7cacac81c1c 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -671,10 +671,11 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx, * with a path prefix. */ if (pstripped != NULL) { - if (len_before_gmt > 0) { + if (len_before_gmt > 1) { /* - * There is a slash before - * the @GMT-. Remove it. + * There is a path (and not only a slash) + * before the @GMT-. Remove the trailing + * slash character. */ len_before_gmt -= 1; } -- cgit v1.2.1