lib: Make create_synthetic_smb_fname use synthetic_smb_fname
authorVolker Lendecke <vl@samba.org>
Fri, 12 Apr 2013 09:00:31 +0000 (11:00 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 17 Apr 2013 21:49:58 +0000 (14:49 -0700)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/filename_util.c

index 2503e77764c23fd13cad757bc413050cd2e990a6..e4900eb10d155d5ccd306b1b7101298ee380bd04 100644 (file)
@@ -59,20 +59,12 @@ NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
                                    const SMB_STRUCT_STAT *psbuf,
                                    struct smb_filename **smb_fname_out)
 {
-       struct smb_filename smb_fname_loc;
-
-       ZERO_STRUCT(smb_fname_loc);
-
-       /* Setup the base_name/stream_name. */
-       smb_fname_loc.base_name = discard_const_p(char, base_name);
-       smb_fname_loc.stream_name = discard_const_p(char, stream_name);
-
-       /* Copy the psbuf if one was given. */
-       if (psbuf)
-               smb_fname_loc.st = *psbuf;
-
-       /* Let copy_smb_filename() do the heavy lifting. */
-       return copy_smb_filename(ctx, &smb_fname_loc, smb_fname_out);
+       *smb_fname_out = synthetic_smb_fname(ctx, base_name, stream_name,
+                                            psbuf);
+       if (*smb_fname_out == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       return NT_STATUS_OK;
 }
 
 struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
@@ -90,7 +82,7 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
        if (psbuf)
                smb_fname_loc.st = *psbuf;
 
-       /* Let copy_smb_filename() do the heavy lifting. */
+       /* Let cp_smb_filename() do the heavy lifting. */
        return cp_smb_filename(mem_ctx, &smb_fname_loc);
 }