[PATCH] mostly clang warnings

Jeremy Allison jra at samba.org
Wed Oct 19 16:34:22 UTC 2016


On Wed, Oct 19, 2016 at 11:10:07AM +0200, Volker Lendecke wrote:
> Jeremy Allison <jra at samba.org> writes:
> 
> > On Tue, Oct 18, 2016 at 11:18:48AM -0700, Jeremy Allison wrote:
> > Bah. The initializer fix patchset fails due to
> > bugs in gcc 4.8.x (which we use on sn-devel).
> >
> > struct smb2_handle foo = { 0 }
> >
> > gives:
> >
> > error: missing braces around initializer [-Werror=missing-braces]
> >
> > because gcc 4.8.x doesn't understand the { 0 }
> > as initializing the array.
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
> >
> > Using:
> >
> > struct smb2_handle foo = {{ 0 }};
> >
> > works, but is really ugly :-(.
> 
> Builds on sn-devel as well as on clang. Attached.
> 
> Review appreciated!

Wow that's ugly, but what can we do ! :-(.

Pushed - thanks !

> From f6863cb192064dacbc5403af3014268f402f97f9 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Wed, 19 Oct 2016 10:27:14 +0200
> Subject: [PATCH] torture: Fix uninitialized variables
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  source4/torture/smb2/acls.c         | 15 +++++++-----
>  source4/torture/smb2/create.c       |  3 ++-
>  source4/torture/smb2/dir.c          |  5 ++--
>  source4/torture/smb2/durable_open.c | 16 ++++++++-----
>  source4/torture/smb2/lease.c        | 45 +++++++++++++++++++++++++-----------
>  source4/torture/smb2/lock.c         | 46 +++++++++++++++++++++++++------------
>  source4/torture/smb2/notify.c       |  5 ++--
>  source4/torture/smb2/streams.c      | 12 ++++++----
>  source4/torture/vfs/acl_xattr.c     |  6 +++--
>  9 files changed, 102 insertions(+), 51 deletions(-)
> 
> diff --git a/source4/torture/smb2/acls.c b/source4/torture/smb2/acls.c
> index d4c575b..beb5abf 100644
> --- a/source4/torture/smb2/acls.c
> +++ b/source4/torture/smb2/acls.c
> @@ -99,7 +99,7 @@ static bool test_creator_sid(struct torture_context *tctx, struct smb2_tree *tre
>  	struct smb2_create io;
>  	const char *fname = BASEDIR "\\creator.txt";
>  	bool ret = true;
> -	struct smb2_handle handle;
> +	struct smb2_handle handle = {{0}};
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
>  	struct security_descriptor *sd, *sd_orig, *sd2;
> @@ -301,7 +301,7 @@ static bool test_generic_bits(struct torture_context *tctx, struct smb2_tree *tr
>  	struct smb2_create io;
>  	const char *fname = BASEDIR "\\generic.txt";
>  	bool ret = true;
> -	struct smb2_handle handle;
> +	struct smb2_handle handle = {{0}};
>  	int i;
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
> @@ -667,7 +667,7 @@ static bool test_owner_bits(struct torture_context *tctx, struct smb2_tree *tree
>  	struct smb2_create io;
>  	const char *fname = BASEDIR "\\test_owner_bits.txt";
>  	bool ret = true;
> -	struct smb2_handle handle;
> +	struct smb2_handle handle = {{0}};
>  	int i;
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
> @@ -803,7 +803,8 @@ static bool test_inheritance(struct torture_context *tctx, struct smb2_tree *tre
>  	const char *fname1 = BASEDIR "\\inheritance\\testfile";
>  	const char *fname2 = BASEDIR "\\inheritance\\testdir";
>  	bool ret = true;
> -	struct smb2_handle handle, handle2;
> +	struct smb2_handle handle = {{0}};
> +	struct smb2_handle handle2 = {{0}};
>  	int i;
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
> @@ -1278,7 +1279,8 @@ static bool test_inheritance_flags(struct torture_context *tctx,
>  	const char *dname = BASEDIR "\\inheritance";
>  	const char *fname1 = BASEDIR "\\inheritance\\testfile";
>  	bool ret = true;
> -	struct smb2_handle handle, handle2;
> +	struct smb2_handle handle = {{0}};
> +	struct smb2_handle handle2 = {{0}};
>  	int i, j;
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
> @@ -1510,7 +1512,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
>  	const char *dname = BASEDIR "\\inheritance";
>  	const char *fname1 = BASEDIR "\\inheritance\\testfile";
>  	bool ret = true;
> -	struct smb2_handle handle, handle2;
> +	struct smb2_handle handle = {{0}};
> +	struct smb2_handle handle2 = {{0}};
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
>  	struct security_descriptor *sd, *sd_orig=NULL;
> diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
> index 9b38400..09a17be 100644
> --- a/source4/torture/smb2/create.c
> +++ b/source4/torture/smb2/create.c
> @@ -706,7 +706,8 @@ static bool test_smb2_open(struct torture_context *tctx,
>  	const char *fname = DNAME "\\torture_ntcreatex.txt";
>  	const char *dname = DNAME "\\torture_ntcreatex.dir";
>  	NTSTATUS status;
> -	struct smb2_handle h, h1;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
>  	bool ret = true;
>  	int i;
>  	struct {
> diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
> index 715e984..2e5db91 100644
> --- a/source4/torture/smb2/dir.c
> +++ b/source4/torture/smb2/dir.c
> @@ -203,7 +203,8 @@ static bool test_fixed(struct torture_context *tctx,
>  {
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create create;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	struct smb2_find f;
>  	union smb_search_data *d;
>  	struct file_elem files[NFILES] = {};
> @@ -1265,7 +1266,7 @@ static bool test_large_files(struct torture_context *tctx,
>  	NTSTATUS status;
>  	struct smb2_create create;
>  	struct smb2_find f;
> -	struct smb2_handle h;
> +	struct smb2_handle h = {{0}};
>  	union smb_search_data *d;
>  	int i, j, file_count = 0;
>  	char **strs = NULL;
> diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
> index 7b59566..2e68170 100644
> --- a/source4/torture/smb2/durable_open.c
> +++ b/source4/torture/smb2/durable_open.c
> @@ -1918,7 +1918,8 @@ static bool test_durable_open_oplock(struct torture_context *tctx,
>  {
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io1, io2;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	char fname[256];
>  	bool ret = true;
> @@ -1993,7 +1994,8 @@ static bool test_durable_open_lease(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io1, io2;
>  	struct smb2_lease ls1, ls2;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	char fname[256];
>  	bool ret = true;
> @@ -2092,7 +2094,7 @@ static bool test_durable_open_lock_oplock(struct torture_context *tctx,
>  {
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
> -	struct smb2_handle h;
> +	struct smb2_handle h = {{0}};
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
>  	NTSTATUS status;
> @@ -2174,7 +2176,7 @@ static bool test_durable_open_lock_lease(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h;
> +	struct smb2_handle h = {{0}};
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
>  	NTSTATUS status;
> @@ -2279,7 +2281,8 @@ static bool test_durable_open_open2_lease(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io1, io2;
>  	struct smb2_lease ls;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	char fname[256];
>  	bool ret = true;
> @@ -2385,7 +2388,8 @@ static bool test_durable_open_open2_oplock(struct torture_context *tctx,
>  {
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io1, io2;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	char fname[256];
>  	bool ret = true;
> diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
> index 6a2e88b..3ee915c 100644
> --- a/source4/torture/smb2/lease.c
> +++ b/source4/torture/smb2/lease.c
> @@ -121,7 +121,8 @@ static bool test_lease_request(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_request.dat";
>  	const char *fname2 = "lease_request.2.dat";
> @@ -209,7 +210,8 @@ static bool test_lease_upgrade(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h, hnew;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle hnew = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_upgrade.dat";
>  	bool ret = true;
> @@ -840,7 +842,8 @@ static bool test_lease_nobreakself(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_nobreakself.dat";
>  	bool ret = true;
> @@ -919,7 +922,8 @@ static bool test_lease_statopen(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_statopen.dat";
>  	bool ret = true;
> @@ -1192,7 +1196,9 @@ static bool test_lease_multibreak(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h, h2, h3;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
> +	struct smb2_handle h3 = {{0}};
>  	struct smb2_write w;
>  	NTSTATUS status;
>  	const char *fname = "lease_multibreak.dat";
> @@ -1311,7 +1317,7 @@ static bool test_lease_v2_request_parent(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls;
> -	struct smb2_handle h1;
> +	struct smb2_handle h1 = {{0}};
>  	uint64_t parent = LEASE2;
>  	NTSTATUS status;
>  	const char *fname = "lease_v2_request_parent.dat";
> @@ -1367,7 +1373,7 @@ static bool test_lease_break_twice(struct torture_context *tctx,
>  	struct smb2_create io;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h1;
> +	struct smb2_handle h1 = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_break_twice.dat";
>  	bool ret = true;
> @@ -1439,7 +1445,11 @@ static bool test_lease_v2_request(struct torture_context *tctx,
>  	TALLOC_CTX *mem_ctx = talloc_new(tctx);
>  	struct smb2_create io;
>  	struct smb2_lease ls1, ls2, ls2t, ls3, ls4;
> -	struct smb2_handle h1, h2, h3, h4, h5;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
> +	struct smb2_handle h3 = {{0}};
> +	struct smb2_handle h4 = {{0}};
> +	struct smb2_handle h5 = {{0}};
>  	struct smb2_write w;
>  	NTSTATUS status;
>  	const char *fname = "lease_v2_request.dat";
> @@ -3060,7 +3070,9 @@ static bool test_lease_complex1(struct torture_context *tctx,
>  	struct smb2_create io2;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h, h2, h3;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
> +	struct smb2_handle h3 = {{0}};
>  	struct smb2_write w;
>  	NTSTATUS status;
>  	const char *fname = "lease_complex1.dat";
> @@ -3186,7 +3198,9 @@ static bool test_lease_v2_complex1(struct torture_context *tctx,
>  	struct smb2_create io2;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h, h2, h3;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
> +	struct smb2_handle h3 = {{0}};
>  	struct smb2_write w;
>  	NTSTATUS status;
>  	const char *fname = "lease_v2_complex1.dat";
> @@ -3331,7 +3345,8 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
>  	struct smb2_create io2;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	struct smb2_request *req2 = NULL;
>  	struct smb2_lease_break_ack ack = {};
>  	NTSTATUS status;
> @@ -3440,7 +3455,9 @@ static bool test_lease_timeout(struct torture_context *tctx,
>  	struct smb2_create io;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h, hnew, h1b;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle hnew = {{0}};
> +	struct smb2_handle h1b = {{0}};
>  	NTSTATUS status;
>  	const char *fname = "lease_timeout.dat";
>  	bool ret = true;
> @@ -3568,7 +3585,9 @@ static bool test_lease_v2_rename(struct torture_context *tctx,
>  	struct smb2_create io;
>  	struct smb2_lease ls1;
>  	struct smb2_lease ls2;
> -	struct smb2_handle h, h1, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	union smb_setfileinfo sinfo;
>  	const char *fname = "lease_v2_rename_src.dat";
>  	const char *fname_dst = "lease_v2_rename_dst.dat";
> diff --git a/source4/torture/smb2/lock.c b/source4/torture/smb2/lock.c
> index 3900abf..ff42211 100644
> --- a/source4/torture/smb2/lock.c
> +++ b/source4/torture/smb2/lock.c
> @@ -587,7 +587,8 @@ static bool test_lock(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -799,7 +800,8 @@ static bool test_async(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -867,7 +869,8 @@ static bool test_cancel(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -995,7 +998,8 @@ static bool test_cancel_tdis(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -1089,7 +1093,8 @@ static bool test_cancel_logoff(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -1185,7 +1190,8 @@ static bool test_errorcode(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[2];
> @@ -1348,7 +1354,8 @@ static bool test_zerobytelength(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	int i;
> @@ -1467,7 +1474,8 @@ static bool test_zerobyteread(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> @@ -1585,7 +1593,8 @@ static bool test_unlock(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el1[1];
> @@ -2136,7 +2145,8 @@ static bool test_stacking(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> @@ -2339,7 +2349,8 @@ static bool test_contend(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> @@ -2408,7 +2419,8 @@ static bool test_context(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> @@ -2474,7 +2486,8 @@ static bool test_range(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> @@ -2675,7 +2688,9 @@ static bool test_overlap(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2, h3;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
> +	struct smb2_handle h3 = {{0}};
>  	uint8_t buf[200];
>  	bool correct = true;
>  
> @@ -2775,7 +2790,8 @@ static bool test_truncate(struct torture_context *torture,
>  {
>  	NTSTATUS status;
>  	bool ret = true;
> -	struct smb2_handle h, h2;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	uint8_t buf[200];
>  	struct smb2_lock lck;
>  	struct smb2_lock_element el[1];
> diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
> index d9b0f59..90f5ad9 100644
> --- a/source4/torture/smb2/notify.c
> +++ b/source4/torture/smb2/notify.c
> @@ -234,7 +234,8 @@ static bool torture_smb2_notify_dir(struct torture_context *torture,
>  	union smb_open io;
>  	union smb_close cl;
>  	int i, count;
> -	struct smb2_handle h1, h2;
> +	struct smb2_handle h1 = {{0}};
> +	struct smb2_handle h2 = {{0}};
>  	struct smb2_request *req, *req2;
>  	const char *fname = BASEDIR "\\subdir-name";
>  	extern int torture_numops;
> @@ -2110,7 +2111,7 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
>  	NTSTATUS status;
>  	union smb_notify notify;
>  	union smb_open io;
> -	struct smb2_handle h1;
> +	struct smb2_handle h1 = {{0}};
>  	struct smb2_request *req = NULL;
>  	struct smb2_tree *tree1 = NULL;
>  	const char *fname = BASEDIR "\\subdir-name";
> diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c
> index 8c3f161..e48a217 100644
> --- a/source4/torture/smb2/streams.c
> +++ b/source4/torture/smb2/streams.c
> @@ -675,7 +675,8 @@ static bool test_stream_delete(struct torture_context *tctx,
>  	const char *fname = DNAME "\\stream_delete.txt";
>  	const char *sname1;
>  	bool ret = true;
> -	struct smb2_handle h, h1;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
>  	struct smb2_read r;
>  
>  	if (torture_setting_bool(tctx, "samba4", false)) {
> @@ -1146,7 +1147,8 @@ static bool test_stream_names2(struct torture_context *tctx,
>  	union smb_open io;
>  	const char *fname = DNAME "\\stream_names2.txt";
>  	bool ret = true;
> -	struct smb2_handle h, h1;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
>  	uint8_t i;
>  
>  	smb2_util_unlink(tree, fname);
> @@ -1247,7 +1249,8 @@ static bool test_stream_rename(struct torture_context *tctx,
>  	union smb_fileinfo finfo1;
>  	union smb_setfileinfo sfinfo;
>  	bool ret = true;
> -	struct smb2_handle h, h1;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
>  
>  	sname1 = talloc_asprintf(mem_ctx, "%s:%s", fname, "Stream One");
>  	sname2 = talloc_asprintf(mem_ctx, "%s:%s:$DaTa", fname,
> @@ -1506,7 +1509,8 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
>  	const char *default_stream_name = "::$DATA";
>  	const char *stream_list[2];
>  	bool ret = true;
> -	struct smb2_handle h, h1;
> +	struct smb2_handle h = {{0}};
> +	struct smb2_handle h1 = {{0}};
>  
>  	/* clean slate .. */
>  	smb2_util_unlink(tree, fname);
> diff --git a/source4/torture/vfs/acl_xattr.c b/source4/torture/vfs/acl_xattr.c
> index df4dd29..676d012 100644
> --- a/source4/torture/vfs/acl_xattr.c
> +++ b/source4/torture/vfs/acl_xattr.c
> @@ -91,7 +91,8 @@ static bool test_default_acl_posix(struct torture_context *tctx,
>  	bool ret = true;
>  	const char *dname = BASEDIR "\\testdir";
>  	const char *fname = BASEDIR "\\testdir\\testfile";
> -	struct smb2_handle fhandle, dhandle;
> +	struct smb2_handle fhandle = {{0}};
> +	struct smb2_handle dhandle = {{0}};
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
>  	struct security_descriptor *sd = NULL;
> @@ -200,7 +201,8 @@ static bool test_default_acl_win(struct torture_context *tctx,
>  	bool ret = true;
>  	const char *dname = BASEDIR "\\testdir";
>  	const char *fname = BASEDIR "\\testdir\\testfile";
> -	struct smb2_handle fhandle, dhandle;
> +	struct smb2_handle fhandle = {{0}};
> +	struct smb2_handle dhandle = {{0}};
>  	union smb_fileinfo q;
>  	union smb_setfileinfo set;
>  	struct security_descriptor *sd = NULL;
> -- 
> 1.9.1
> 




More information about the samba-technical mailing list