From 5fbbddec353a9f809db549d21c16e5c9d9fbbd5b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 4 Feb 2009 08:50:46 +0100 Subject: [PATCH] s4:pvfs: fix some talloc related compiler warnings metze --- source4/ntvfs/posix/pvfs_acl.c | 2 +- source4/ntvfs/posix/pvfs_rename.c | 4 +++- source4/ntvfs/posix/pvfs_resolve.c | 4 +++- source4/ntvfs/posix/pvfs_util.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source4/ntvfs/posix/pvfs_acl.c b/source4/ntvfs/posix/pvfs_acl.c index d479f1e2ee0..1adced44aa4 100644 --- a/source4/ntvfs/posix/pvfs_acl.c +++ b/source4/ntvfs/posix/pvfs_acl.c @@ -51,7 +51,7 @@ NTSTATUS pvfs_acl_register(const struct pvfs_acl_ops *ops) backends = talloc_realloc(talloc_autofree_context(), backends, struct pvfs_acl_backend, num_backends+1); NT_STATUS_HAVE_NO_MEMORY(backends); - new_ops = talloc_memdup(backends, ops, sizeof(*ops)); + new_ops = (struct pvfs_acl_ops *)talloc_memdup(backends, ops, sizeof(*ops)); new_ops->name = talloc_strdup(new_ops, ops->name); backends[num_backends].ops = new_ops; diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c index ed90bf3d7bd..80014281229 100644 --- a/source4/ntvfs/posix/pvfs_rename.c +++ b/source4/ntvfs/posix/pvfs_rename.c @@ -103,7 +103,7 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx, char *dest, *d; /* the length is bounded by the length of the two strings combined */ - dest = talloc_size(mem_ctx, strlen(fname) + strlen(pattern) + 1); + dest = talloc_array(mem_ctx, char, strlen(fname) + strlen(pattern) + 1); if (dest == NULL) { return NULL; } @@ -133,6 +133,8 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx, *d = 0; + talloc_set_name_const(dest, dest); + return dest; } diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index 43547c275b5..c33323350e0 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -464,7 +464,7 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, } /* rebuild the name */ - ret = talloc_size(mem_ctx, len+1); + ret = talloc_array(mem_ctx, char, len+1); if (ret == NULL) { talloc_free(s); return NT_STATUS_NO_MEMORY; @@ -478,6 +478,8 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, } ret[len] = 0; + talloc_set_name_const(ret, ret); + talloc_free(s); *fname = ret; diff --git a/source4/ntvfs/posix/pvfs_util.c b/source4/ntvfs/posix/pvfs_util.c index 09913bc9115..81ff20a6083 100644 --- a/source4/ntvfs/posix/pvfs_util.c +++ b/source4/ntvfs/posix/pvfs_util.c @@ -93,7 +93,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs, mode_t mode; NTSTATUS status; size_t buf_size = 0x10000; - char *buf = talloc_size(name2, buf_size); + uint8_t *buf = talloc_array(name2, uint8_t, buf_size); if (buf == NULL) { return NT_STATUS_NO_MEMORY; -- 2.34.1