syntax error in source3/locking/brlock.c

Christof Schmitt cs at samba.org
Fri Mar 6 15:54:04 MST 2015


On Fri, Mar 06, 2015 at 01:54:38PM -0700, Christof Schmitt wrote:
> On Fri, Mar 06, 2015 at 09:41:19PM +0100, Volker Lendecke wrote:
> > On Fri, Mar 06, 2015 at 01:35:31PM -0700, Christof Schmitt wrote:
> > > On Fri, Mar 06, 2015 at 01:26:43PM -0500, Thomas Schulz wrote:
> > > > I have been building 4.2.0 on Solaris 10 using the GNU C compiler. I decided
> > > > to see what happens with Sun's C 5.11 SunOS_i386 compiler. It complains
> > > > with the following error:
> > > > 
> > > > "../source3/locking/brlock.c", line 2008: syntax error before or at: }
> > > > cc: acomp failed for ../source3/locking/brlock.c
> > > > 
> > > > The offending line is:
> > > > 
> > > >         *br_lck = (struct byte_range_lock) {};
> > > > 
> > > > The GNU C compiler thinks that this line is OK. Does anyone have an
> > > > idea what is intended here and why the Sun compiler does not like it?
> > > 
> > > Try changing this to:
> > > 	*br_lck = (struct byte_range_lock) { 0 };
> > > 
> > > I think that strictly speaking C, does not allow omitting the 0, but C++
> > > compatible compilers allow it. With -pedantic, gcc also warns about
> > > this:  warning: ISO C forbids empty initializer braces
> > 
> > Yep.
> > 
> > $ git grep '{}'|grep c:|wc -l
> > 153
> > 
> > That would be a 153-line patch I guess. Or you can gain 153
> > ohloh-points with single patches :-)
> 
> It might be even less than 153 patches, there also some empty code
> blocks in there. Let me try to put a patch together, having single
> patches would be too much overhead.

The diffstat now shows 124 lines, see attached patch. Would be it
possible to compile test master with this patch with the SunOS compiler,
to see whether there are other issues remaining?

Christof
-------------- next part --------------
From 29a64da616733307f7f67db4b3ef0bbb46c0de0f Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Fri, 6 Mar 2015 13:59:21 -0700
Subject: [PATCH] Use 0 instead of empty initializer list

C does not allow empty initializer lists. Although gcc accepts that, the
SunOS compiler fails with an error.

Signed-off-by: Christof Schmitt <cs at samba.org>
---
 auth/gensec/schannel.c             |    2 +-
 lib/ldb/common/ldb_msg.c           |    4 +-
 libcli/auth/netlogon_creds_cli.c   |    2 +-
 source3/lib/messages_dgm.c         |    2 +-
 source3/lib/srprs.c                |    2 +-
 source3/locking/brlock.c           |    2 +-
 source3/modules/non_posix_acls.c   |    2 +-
 source3/passdb/pdb_get_set.c       |    2 +-
 source3/passdb/pdb_samba_dsdb.c    |    4 +-
 source3/profile/profile.c          |   14 ++--
 source3/smbd/dir.c                 |    4 +-
 source3/smbd/notify_internal.c     |    2 +-
 source3/utils/status_profile.c     |    2 +-
 source4/kdc/db-glue.c              |    4 +-
 source4/lib/wmi/tools/wmic.c       |    2 +-
 source4/lib/wmi/tools/wmis.c       |    2 +-
 source4/libcli/wbclient/wbclient.c |    4 +-
 source4/torture/raw/acls.c         |    6 +-
 source4/torture/raw/unlink.c       |    2 +-
 source4/torture/rpc/schannel.c     |   16 ++--
 source4/torture/smb2/create.c      |    2 +-
 source4/torture/smb2/dir.c         |   10 +-
 source4/torture/smb2/lease.c       |  152 ++++++++++++++++++------------------
 source4/torture/smb2/util.c        |    4 +-
 24 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/auth/gensec/schannel.c b/auth/gensec/schannel.c
index 9b28c45..b137f04 100644
--- a/auth/gensec/schannel.c
+++ b/auth/gensec/schannel.c
@@ -459,7 +459,7 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_
 		struct schannel_state);
 	NTSTATUS status;
 	enum ndr_err_code ndr_err;
-	struct NL_AUTH_MESSAGE bind_schannel = {};
+	struct NL_AUTH_MESSAGE bind_schannel = { 0 };
 	struct NL_AUTH_MESSAGE bind_schannel_ack;
 	struct netlogon_creds_CredentialState *creds;
 	const char *workstation;
diff --git a/lib/ldb/common/ldb_msg.c b/lib/ldb/common/ldb_msg.c
index 3f65351..1be8115 100644
--- a/lib/ldb/common/ldb_msg.c
+++ b/lib/ldb/common/ldb_msg.c
@@ -1090,8 +1090,8 @@ time_t ldb_string_to_time(const char *s)
 */
 int ldb_val_to_time(const struct ldb_val *v, time_t *t)
 {
-	char val[15] = {};
-	struct tm tm = {};
+	char val[15] = { 0 };
+	struct tm tm = { 0 };
 
 	if (v == NULL) {
 		return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index 1ea2f75..0ec1ce4 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -3003,7 +3003,7 @@ static void netlogon_creds_cli_ServerGetTrustInfo_done(struct tevent_req *subreq
 		struct netlogon_creds_cli_ServerGetTrustInfo_state);
 	NTSTATUS status;
 	NTSTATUS result;
-	const struct samr_Password zero = {};
+	const struct samr_Password zero = { { 0 } };
 	int cmp;
 	bool ok;
 
diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index 1602caf..7492f4b 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -305,7 +305,7 @@ int messaging_dgm_cleanup(pid_t pid)
 	struct messaging_dgm_context *ctx = global_dgm_context;
 	struct sun_path_buf lockfile_name, socket_name;
 	int fd, len, ret;
-	struct flock lck = {};
+	struct flock lck = { 0 };
 
 	if (ctx == NULL) {
 		return ENOTCONN;
diff --git a/source3/lib/srprs.c b/source3/lib/srprs.c
index a3fd0c3..23d5d80 100644
--- a/source3/lib/srprs.c
+++ b/source3/lib/srprs.c
@@ -129,7 +129,7 @@ bool srprs_hex(const char** ptr, size_t len, unsigned* u)
 	const char *pos = *ptr;
 	int ret;
 	int i;
-	char buf[8+1] = {};
+	char buf[8+1] = { 0 };
 
 	assert((len >= 1) && (len <= 8));
 
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 7fd3783..46401a0 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -2014,7 +2014,7 @@ static void brl_get_locks_readonly_parser(TDB_DATA key, TDB_DATA data,
 		*state->br_lock = NULL;
 		return;
 	}
-	*br_lck = (struct byte_range_lock) {};
+	*br_lck = (struct byte_range_lock) { 0 };
 	if (!brl_parse_data(br_lck, data)) {
 		*state->br_lock = NULL;
 		return;
diff --git a/source3/modules/non_posix_acls.c b/source3/modules/non_posix_acls.c
index b1c2420..3fa90d0 100644
--- a/source3/modules/non_posix_acls.c
+++ b/source3/modules/non_posix_acls.c
@@ -29,7 +29,7 @@ int non_posix_sys_acl_blob_get_file_helper(vfs_handle_struct *handle,
 {
 	int ret;
 	TALLOC_CTX *frame = talloc_stackframe();
-	struct xattr_sys_acl_hash_wrapper acl_wrapper = {};
+	struct xattr_sys_acl_hash_wrapper acl_wrapper = { { 0 } };
 	struct smb_filename *smb_fname;
 
 	smb_fname = synthetic_smb_fname_split(frame, path_p, NULL);
diff --git a/source3/passdb/pdb_get_set.c b/source3/passdb/pdb_get_set.c
index 5e162db..af5116f 100644
--- a/source3/passdb/pdb_get_set.c
+++ b/source3/passdb/pdb_get_set.c
@@ -872,7 +872,7 @@ bool pdb_set_lanman_passwd(struct samu *sampass, const uint8 pwd[LM_HASH_LEN], e
 
 bool pdb_set_pw_history(struct samu *sampass, const uint8 *pwd, uint32_t historyLen, enum pdb_value_state flag)
 {
-	DATA_BLOB new_nt_pw_his = {};
+	DATA_BLOB new_nt_pw_his = { 0 };
 
 	if (historyLen && pwd){
 		new_nt_pw_his = data_blob_talloc(sampass,
diff --git a/source3/passdb/pdb_samba_dsdb.c b/source3/passdb/pdb_samba_dsdb.c
index bbedd88..bf3a2a9 100644
--- a/source3/passdb/pdb_samba_dsdb.c
+++ b/source3/passdb/pdb_samba_dsdb.c
@@ -2285,8 +2285,8 @@ static NTSTATUS pdb_samba_dsdb_get_trusteddom_creds(struct pdb_methods *m,
 	int trust_direction_flags;
 	int trust_type;
 	int i;
-	DATA_BLOB password_utf16 = {};
-	DATA_BLOB password_nt = {};
+	DATA_BLOB password_utf16 = { 0 };
+	DATA_BLOB password_nt = { 0 };
 	struct trustAuthInOutBlob password_blob;
 	struct AuthenticationInformationArray *auth_array = NULL;
 	enum ndr_err_code ndr_err;
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 67b1fc7..c617c4f 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -121,7 +121,7 @@ static void reqprofile_message(struct messaging_context *msg_ctx,
   ******************************************************************/
 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
 {
-	unsigned char tmp[16] = {};
+	unsigned char tmp[16] = { 0 };
 	MD5_CTX md5;
 	char *db_name;
 
@@ -246,13 +246,13 @@ static int profile_stats_parser(TDB_DATA key, TDB_DATA value,
 	struct profile_stats *s = private_data;
 
 	if (value.dsize != sizeof(struct profile_stats)) {
-		*s = (struct profile_stats) {};
+		*s = (struct profile_stats) { 0 };
 		return 0;
 	}
 
 	memcpy(s, value.dptr, value.dsize);
 	if (s->magic != profile_p->magic) {
-		*s = (struct profile_stats) {};
+		*s = (struct profile_stats) { 0 };
 		return 0;
 	}
 
@@ -263,7 +263,7 @@ void smbprofile_dump(void)
 {
 	pid_t pid = getpid();
 	TDB_DATA key = { .dptr = (uint8_t *)&pid, .dsize = sizeof(pid) };
-	struct profile_stats s = {};
+	struct profile_stats s = { 0 };
 	int ret;
 #ifdef HAVE_GETRUSAGE
 	struct rusage rself;
@@ -315,8 +315,8 @@ void smbprofile_dump(void)
 void smbprofile_cleanup(pid_t pid)
 {
 	TDB_DATA key = { .dptr = (uint8_t *)&pid, .dsize = sizeof(pid) };
-	struct profile_stats s = {};
-	struct profile_stats acc = {};
+	struct profile_stats s = { 0 };
+	struct profile_stats acc = { 0 };
 	int ret;
 
 	if (smbprofile_state.internal.db == NULL) {
@@ -428,7 +428,7 @@ static int smbprofile_collect_fn(struct tdb_context *tdb,
 
 void smbprofile_collect(struct profile_stats *stats)
 {
-	*stats = (struct profile_stats) {};
+	*stats = (struct profile_stats) { 0 };
 
 	if (smbprofile_state.internal.db == NULL) {
 		return;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 073ac2f..eb5f982 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1863,7 +1863,7 @@ static int files_below_forall(connection_struct *conn,
 					void *private_data),
 			      void *private_data)
 {
-	struct files_below_forall_state state = {};
+	struct files_below_forall_state state = { 0 };
 	int ret;
 	char tmpbuf[PATH_MAX];
 	char *to_free;
@@ -1898,7 +1898,7 @@ static int have_file_open_below_fn(struct file_id fid,
 static bool have_file_open_below(connection_struct *conn,
 				 const struct smb_filename *name)
 {
-	struct have_file_open_below_state state = {};
+	struct have_file_open_below_state state = { 0 };
 	int ret;
 
 	if (!VALID_STAT(name->st)) {
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index e612f16..6b1818f 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -807,7 +807,7 @@ static NTSTATUS notify_send(struct notify_context *notify,
 			    const char *path, uint32_t action,
 			    void *private_data)
 {
-	struct notify_msg m = {};
+	struct notify_msg m = { { 0 } };
 	struct iovec iov[2];
 
 	m.when = timespec_current();
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index 109415d..885e602 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -42,7 +42,7 @@ static void profile_separator(const char * title)
   ******************************************************************/
 bool status_profile_dump(bool verbose)
 {
-	struct profile_stats stats = {};
+	struct profile_stats stats = { 0 };
 
 	if (!profile_setup(NULL, True)) {
 		fprintf(stderr,"Failed to initialise profile memory\n");
diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c
index aa73641..0a544b8 100644
--- a/source4/kdc/db-glue.c
+++ b/source4/kdc/db-glue.c
@@ -1163,7 +1163,7 @@ static krb5_error_code samba_kdc_trust_message2entry(krb5_context context,
 	}
 
 	if (password_utf8.length != 0) {
-		Key key = {};
+		Key key = { 0 };
 		krb5_const_principal salt_principal = principal;
 		krb5_salt salt;
 		krb5_data cleartext_data;
@@ -1212,7 +1212,7 @@ static krb5_error_code samba_kdc_trust_message2entry(krb5_context context,
 	}
 
 	if (password_hash != NULL) {
-		Key key = {};
+		Key key = { 0 };
 
 		ret = krb5_keyblock_init(context,
 					 ENCTYPE_ARCFOUR_HMAC,
diff --git a/source4/lib/wmi/tools/wmic.c b/source4/lib/wmi/tools/wmic.c
index bbfe5ed..2307832 100644
--- a/source4/lib/wmi/tools/wmic.c
+++ b/source4/lib/wmi/tools/wmic.c
@@ -154,7 +154,7 @@ char *string_CIMVAR(TALLOC_CTX *mem_ctx, union CIMVAR *v, enum CIMTYPE_ENUMERATI
 
 int main(int argc, char **argv)
 {
-	struct program_args args = {};
+	struct program_args args = { 0 };
 	uint32_t cnt = 5, ret;
 	char *class_name = NULL;
 	WERROR result;
diff --git a/source4/lib/wmi/tools/wmis.c b/source4/lib/wmi/tools/wmis.c
index 314fdd1..1cfe7d8 100644
--- a/source4/lib/wmi/tools/wmis.c
+++ b/source4/lib/wmi/tools/wmis.c
@@ -178,7 +178,7 @@ error:
 
 int main(int argc, char **argv)
 {
-	struct program_args args = {};
+	struct program_args args = { 0 };
 	struct com_context *ctx = NULL;
 	WERROR result;
 	NTSTATUS status;
diff --git a/source4/libcli/wbclient/wbclient.c b/source4/libcli/wbclient/wbclient.c
index bb89435..9117799 100644
--- a/source4/libcli/wbclient/wbclient.c
+++ b/source4/libcli/wbclient/wbclient.c
@@ -72,7 +72,7 @@ static const char *winbindd_socket_dir(void)
 
 static int winbindd_pipe_sock(void)
 {
-	struct sockaddr_un sunaddr = {};
+	struct sockaddr_un sunaddr = { 0 };
 	int ret, fd;
 	char *path;
 
@@ -106,7 +106,7 @@ NTSTATUS wbc_sids_to_xids(struct tevent_context *ev, struct id_map *ids,
 			  uint32_t count)
 {
 	TALLOC_CTX *mem_ctx;
-	struct winbindd_request req = {};
+	struct winbindd_request req = { 0 };
 	struct winbindd_response *resp;
 	uint32_t i;
 	int fd, ret, err;
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 360d937..91e108a 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -71,7 +71,7 @@ static bool verify_sd(TALLOC_CTX *tctx, struct smbcli_state *cli,
 {
 	NTSTATUS status;
 	bool ret = true;
-	union smb_fileinfo q = {};
+	union smb_fileinfo q = { { 0 } };
 
 	if (sd) {
 		q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
@@ -103,7 +103,7 @@ static bool verify_attrib(TALLOC_CTX *tctx, struct smbcli_state *cli,
 {
 	NTSTATUS status;
 	bool ret = true;
-	union smb_fileinfo q2 = {};
+	union smb_fileinfo q2 = { { 0 } };
 
 	if (attrib) {
 		q2.standard.level = RAW_FILEINFO_STANDARD;
@@ -227,7 +227,7 @@ static bool test_nttrans_create_ext(struct torture_context *tctx,
 	const char *fname = BASEDIR "\\acl2.txt";
 	bool ret = true;
 	int fnum = -1;
-	union smb_fileinfo q = {};
+	union smb_fileinfo q = { { 0 } };
 	struct security_ace ace;
 	struct security_descriptor *sd;
 	struct dom_sid *test_sid;
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index 25edb5e..420678d 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -482,7 +482,7 @@ static bool test_unlink_defer(struct torture_context *tctx,
 	bool ret = true;
 	union smb_open io;
 	union smb_unlink unl;
-	struct unlink_defer_cli_state ud_cli_state = {};
+	struct unlink_defer_cli_state ud_cli_state = { 0 };
 
 	if (!torture_setup_dir(cli1, BASEDIR)) {
 		return false;
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index b5a76ec..1329324 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -582,10 +582,10 @@ static bool test_schannel_anonymous_setPassword(struct torture_context *tctx,
 	torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel");
 
 	if (use2) {
-		struct netr_ServerPasswordSet2 r = {};
-		struct netr_Authenticator credential = {};
-		struct netr_Authenticator return_authenticator = {};
-		struct netr_CryptPassword new_password = {};
+		struct netr_ServerPasswordSet2 r = { { 0 } };
+		struct netr_Authenticator credential = { { { 0 } } };
+		struct netr_Authenticator return_authenticator = { { { 0 } } };
+		struct netr_CryptPassword new_password = { { 0 } };
 
 		r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
 		r.in.account_name = talloc_asprintf(tctx, "%s$", TEST_MACHINE_NAME);
@@ -598,10 +598,10 @@ static bool test_schannel_anonymous_setPassword(struct torture_context *tctx,
 		status = dcerpc_netr_ServerPasswordSet2_r(p->binding_handle, tctx, &r);
 		result = r.out.result;
 	} else {
-		struct netr_ServerPasswordSet r = {};
-		struct netr_Authenticator credential = {};
-		struct netr_Authenticator return_authenticator = {};
-		struct samr_Password new_password = {};
+		struct netr_ServerPasswordSet r = { { 0 } };
+		struct netr_Authenticator credential = { { { 0 } } };
+		struct netr_Authenticator return_authenticator = { { { 0 } } };
+		struct samr_Password new_password = { { 0 } };
 
 		r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
 		r.in.account_name = talloc_asprintf(tctx, "%s$", TEST_MACHINE_NAME);
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index 44650b5..eff2a73 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -570,7 +570,7 @@ static bool test_create_acl_ext(struct torture_context *tctx, struct smb2_tree *
 	struct security_ace ace;
 	struct security_descriptor *sd;
 	struct dom_sid *test_sid;
-	union smb_fileinfo q = {};
+	union smb_fileinfo q = { { 0 } };
 	uint32_t attrib =
 	    FILE_ATTRIBUTE_HIDDEN |
 	    FILE_ATTRIBUTE_SYSTEM |
diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
index cf96fee..6369e84 100644
--- a/source4/torture/smb2/dir.c
+++ b/source4/torture/smb2/dir.c
@@ -108,7 +108,7 @@ static bool test_find(struct torture_context *tctx,
 	struct smb2_handle h;
 	struct smb2_find f;
 	union smb_search_data *d;
-	struct file_elem files[NFILES] = {};
+	struct file_elem files[NFILES] = { { 0 } };
 	NTSTATUS status;
 	bool ret = true;
 	unsigned int count;
@@ -203,7 +203,7 @@ static bool test_fixed(struct torture_context *tctx,
 	struct smb2_handle h, h2;
 	struct smb2_find f;
 	union smb_search_data *d;
-	struct file_elem files[NFILES] = {};
+	struct file_elem files[NFILES] = { { 0 } };
 	NTSTATUS status;
 	bool ret = true;
 	unsigned int count;
@@ -902,7 +902,7 @@ static bool test_modify_search(struct torture_context *tctx,
 	struct smb2_handle h;
 	struct smb2_find f;
 	union smb_search_data *d;
-	struct file_elem files[703] = {};
+	struct file_elem files[703] = { { 0 } };
 	int num_files = ARRAY_SIZE(files)-3;
 	NTSTATUS status;
 	bool ret = true;
@@ -1056,7 +1056,7 @@ static bool test_sorted(struct torture_context *tctx,
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	const int num_files = 700;
 	int i;
-	struct file_elem files[700] = {};
+	struct file_elem files[700] = { { 0 } };
 	bool ret = true;
 	NTSTATUS status;
 	struct multiple_result result;
@@ -1227,7 +1227,7 @@ static bool test_large_files(struct torture_context *tctx,
 	int max_len = 200;
 	/* These should be evenly divisible */
 	int num_at_len = num_files / max_len;
-	struct file_elem files[2000] = {};
+	struct file_elem files[2000] = { { 0 } };
 	size_t len = 1;
 	bool ret = true;
 	NTSTATUS status;
diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c
index 4b435a1..6fd9d32 100644
--- a/source4/torture/smb2/lease.c
+++ b/source4/torture/smb2/lease.c
@@ -1655,7 +1655,7 @@ static bool test_lease_v2_epoch2(struct torture_context *tctx,
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	struct smb2_create io;
 	struct smb2_lease ls1v2, ls1v2t, ls1v1;
-	struct smb2_handle hv2 = {}, hv1 = {};
+	struct smb2_handle hv2 = { { 0 } }, hv1 = { { 0 } };
 	const char *fname = "lease_v2_epoch2.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -1759,8 +1759,9 @@ static bool test_lease_v2_epoch3(struct torture_context *tctx,
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	struct smb2_create io;
-	struct smb2_lease ls1v1 = {}, ls1v1t = {},ls1v2 = {};
-	struct smb2_handle hv1 = {}, hv2 = {};
+	struct smb2_lease ls1v1 = { { { 0 } } }, ls1v1t = { { { 0 } }} ,
+			  ls1v2 = { { { 0 } } };
+	struct smb2_handle hv1 = { { 0 } }, hv2 = { { 0 } };
 	const char *fname = "lease_v2_epoch3.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -1861,14 +1862,14 @@ static bool test_lease_breaking1(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_handle h1a = {};
-	struct smb2_handle h1b = {};
-	struct smb2_handle h2 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_handle h1a = { { 0 } };
+	struct smb2_handle h1b = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
 	struct smb2_request *req2 = NULL;
-	struct smb2_lease_break_ack ack = {};
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "lease_breaking1.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -1968,14 +1969,14 @@ static bool test_lease_breaking2(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_handle h1a = {};
-	struct smb2_handle h1b = {};
-	struct smb2_handle h2 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_handle h1a = { { 0 } };
+	struct smb2_handle h1b = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
 	struct smb2_request *req2 = NULL;
-	struct smb2_lease_break_ack ack = {};
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "lease_breaking2.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -2119,18 +2120,18 @@ static bool test_lease_breaking3(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_create io3 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_handle h1a = {};
-	struct smb2_handle h1b = {};
-	struct smb2_handle h2 = {};
-	struct smb2_handle h3 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_create io3 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_handle h1a = { { 0 } };
+	struct smb2_handle h1b = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
+	struct smb2_handle h3 = { { 0 } };
 	struct smb2_request *req2 = NULL;
 	struct smb2_request *req3 = NULL;
-	struct torture_lease_break break_info_tmp = {};
-	struct smb2_lease_break_ack ack = {};
+	struct torture_lease_break break_info_tmp = { { { { { 0 } } } } };
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "lease_breaking3.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -2307,18 +2308,18 @@ static bool test_lease_v2_breaking3(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_create io3 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_handle h1a = {};
-	struct smb2_handle h1b = {};
-	struct smb2_handle h2 = {};
-	struct smb2_handle h3 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_create io3 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_handle h1a = { { 0 } };
+	struct smb2_handle h1b = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
+	struct smb2_handle h3 = { { 0 } };
 	struct smb2_request *req2 = NULL;
 	struct smb2_request *req3 = NULL;
-	struct torture_lease_break break_info_tmp = {};
-	struct smb2_lease_break_ack ack = {};
+	struct torture_lease_break break_info_tmp = { { { { { 0 } } } } };
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "v2_lease_breaking3.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -2513,18 +2514,17 @@ static bool test_lease_breaking4(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_create io3 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_lease ls1t = {};
-	struct smb2_handle h1 = {};
-	struct smb2_handle h2 = {};
-	struct smb2_handle h3 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_create io3 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_lease ls1t = { { { 0 } } };
+	struct smb2_handle h1 = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
+	struct smb2_handle h3 = { { 0 } };
 	struct smb2_request *req2 = NULL;
-	struct torture_lease_break break_info_tmp = {};
-	struct smb2_lease_break_ack ack = {};
-	const char *fname = "lease_breaking4.dat";
+	struct torture_lease_break break_info_tmp = { { { { { 0 } } } } };
+	struct smb2_lease_break_ack ack = { { 0 } }; const char *fname = "lease_breaking4.dat";
 	bool ret = true;
 	NTSTATUS status;
 	uint32_t caps;
@@ -2658,17 +2658,17 @@ static bool test_lease_breaking5(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_create io3 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_lease ls1t = {};
-	struct smb2_handle h1 = {};
-	struct smb2_handle h2 = {};
-	struct smb2_handle h3 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_create io3 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_lease ls1t = { { { 0 } } };
+	struct smb2_handle h1 = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
+	struct smb2_handle h3 = { { 0 } };
 	struct smb2_request *req2 = NULL;
-	struct torture_lease_break break_info_tmp = {};
-	struct smb2_lease_break_ack ack = {};
+	struct torture_lease_break break_info_tmp = { { { { { 0 } } } } };
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "lease_breaking5.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -2777,14 +2777,14 @@ static bool test_lease_breaking6(struct torture_context *tctx,
 				 struct smb2_tree *tree)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_handle h1a = {};
-	struct smb2_handle h1b = {};
-	struct smb2_handle h2 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_handle h1a = { { 0 } };
+	struct smb2_handle h1b = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
 	struct smb2_request *req2 = NULL;
-	struct smb2_lease_break_ack ack = {};
+	struct smb2_lease_break_ack ack = { { 0 } };
 	const char *fname = "lease_breaking6.dat";
 	bool ret = true;
 	NTSTATUS status;
@@ -2885,15 +2885,15 @@ static bool test_lease_lock1(struct torture_context *tctx,
 			     struct smb2_tree *tree2)
 {
 	TALLOC_CTX *mem_ctx = talloc_new(tctx);
-	struct smb2_create io1 = {};
-	struct smb2_create io2 = {};
-	struct smb2_create io3 = {};
-	struct smb2_lease ls1 = {};
-	struct smb2_lease ls2 = {};
-	struct smb2_lease ls3 = {};
-	struct smb2_handle h1 = {};
-	struct smb2_handle h2 = {};
-	struct smb2_handle h3 = {};
+	struct smb2_create io1 = { 0 };
+	struct smb2_create io2 = { 0 };
+	struct smb2_create io3 = { 0 };
+	struct smb2_lease ls1 = { { { 0 } } };
+	struct smb2_lease ls2 = { { { 0 } } };
+	struct smb2_lease ls3 = { { { 0 } } };
+	struct smb2_handle h1 = { { 0 } };
+	struct smb2_handle h2 = { { 0 } };
+	struct smb2_handle h3 = { { 0 } };
 	struct smb2_lock lck;
 	struct smb2_lock_element el[1];
 	const char *fname = "locktest.dat";
@@ -3333,7 +3333,7 @@ static bool test_lease_v2_complex2(struct torture_context *tctx,
 	struct smb2_lease ls2;
 	struct smb2_handle h, h2;
 	struct smb2_request *req2 = NULL;
-	struct smb2_lease_break_ack ack = {};
+	struct smb2_lease_break_ack ack = { { 0 } };
 	NTSTATUS status;
 	const char *fname = "lease_v2_complex2.dat";
 	bool ret = true;
@@ -3444,7 +3444,7 @@ static bool test_lease_timeout(struct torture_context *tctx,
 	NTSTATUS status;
 	const char *fname = "lease_timeout.dat";
 	bool ret = true;
-	struct smb2_lease_break_ack ack = {};
+	struct smb2_lease_break_ack ack = { { 0 } };
 	struct smb2_request *req2 = NULL;
 	struct smb2_write w;
 	uint32_t caps;
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 814e398..28812d8 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -576,7 +576,7 @@ bool smb2_util_verify_sd(TALLOC_CTX *tctx, struct smb2_tree *tree,
 {
 	NTSTATUS status;
 	bool ret = true;
-	union smb_fileinfo q = {};
+	union smb_fileinfo q = { { 0 } };
 
 	q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
 	q.query_secdesc.in.file.handle = handle;
@@ -612,7 +612,7 @@ bool smb2_util_verify_attrib(TALLOC_CTX *tctx, struct smb2_tree *tree,
 {
 	NTSTATUS status;
 	bool ret = true;
-	union smb_fileinfo q = {};
+	union smb_fileinfo q = { { 0 } };
 
 	q.standard.level = RAW_FILEINFO_SMB2_ALL_INFORMATION;
 	q.standard.in.file.handle = handle;
-- 
1.7.1



More information about the samba-technical mailing list