From 151774ed18f9e90b9d9720c1050ab1f924578f59 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 29 May 2013 17:14:49 +0200 Subject: [PATCH] shadow_copy2: add comments explaining decisions in shadow_copy2_strip_snapshot() This should make it more easy to understand what the cases are. Signed-off-by: Michael Adam Reviewed-by: Andrew Bartlett (cherry picked from commit 3d053b1ab3e0b918509e06086a54834a9ae9cdb7) --- source3/modules/vfs_shadow_copy2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 58aa28ce78c..7fd53807f52 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -316,6 +316,7 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, goto no_snapshot; } if ((p > name) && (p[-1] != '/')) { + /* the GMT-token does not start a path-component */ goto no_snapshot; } q = strptime(p, GMT_FORMAT, &tm); @@ -328,6 +329,7 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, goto no_snapshot; } if ((p == name) && (q[0] == '\0')) { + /* the name consists of only the GMT token */ if (pstripped != NULL) { stripped = talloc_strdup(mem_ctx, ""); if (stripped == NULL) { @@ -339,6 +341,14 @@ static bool shadow_copy2_strip_snapshot(TALLOC_CTX *mem_ctx, return true; } if (q[0] != '/') { + /* + * The GMT token is either at the end of the path + * or it is not a complete path component, i.e. the + * path component continues after the gmt-token. + * + * TODO: Is this correct? Or would the GMT tag as the + * last component be a valid input? + */ goto no_snapshot; } q += 1; -- 2.11.4.GIT