From: Volker Lendecke Date: Thu, 15 Sep 2022 13:11:55 +0000 (-0700) Subject: shadow_copy2: Use dirfsp if it's around X-Git-Tag: talloc-2.4.0~954 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbf93c9e0f5d592b3cbac4c705cb10dbc9e20ea6;p=thirdparty%2Fsamba.git shadow_copy2: Use dirfsp if it's around Not used yet, and the "if" around dirfsp!=NULL will go away in a later patch. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index a2e27f3a938..85dec164d50 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -2634,7 +2634,7 @@ static const char *shadow_copy2_connectpath( char *stripped = NULL; char *tmp = NULL; const char *fname = smb_fname_in->base_name; - struct smb_filename *full = NULL; + const struct smb_filename *full = smb_fname_in; struct smb_filename smb_fname = {0}; struct smb_filename *result_fname = NULL; char *result = NULL; @@ -2654,10 +2654,12 @@ static const char *shadow_copy2_connectpath( return priv->shadow_connectpath; } - full = full_path_from_dirfsp_atname( - talloc_tos(), dirfsp, smb_fname_in); - if (full == NULL) { - return NULL; + if (dirfsp != NULL) { + full = full_path_from_dirfsp_atname( + talloc_tos(), dirfsp, smb_fname_in); + if (full == NULL) { + return NULL; + } } if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, full,