syntax error in source3/locking/brlock.c

Christof Schmitt cs at samba.org
Tue Mar 10 11:18:34 MDT 2015


On Tue, Mar 10, 2015 at 11:09:54AM -0400, Thomas Schulz wrote:
> > On Mon, Mar 09, 2015 at 01:12:48PM -0400, Thomas Schulz wrote:
> > > It looks like we are only going the fix the one file with the fatal error,
> > > but I just tried the smaller patch. It applied cleanly and the result
> > > builds correctly. I do wonder about lines such as:
> > > 
> > > +       struct torture_lease_break break_info_tmp = { { { { { 0 } } } } };
> > > 
> > > I am affraid that we are in danger of using up the world's supply of
> > > braces. :-)
> > 
> > Is Solaris happy with just {0}?
> > 
> > Thanks,
> > 
> > Volker
> 
> I just tried it and just { 0 } makes the Solaris compiler happy.
> I am not a good enough C programmer to understand why more than one set
> of braces might be needed, I just thought that those lines looked odd.
> 
> I also just noticed that the small patch misses one instance in
> source4/torture/smb2/util.c. The large patch had both of them.

Based on the comments in this thread, i think we should just change the
instances that cause problems with the Solaris compiler. Can you confirm
that these are the required changes?

source4/torture/smb2/util.c

-       union smb_fileinfo q = {};
+       union smb_fileinfo q = { 0 };

source3/locking/brlock.c

-       *br_lck = (struct byte_range_lock) {};
+       *br_lck = (struct byte_range_lock) { 0 };

Converting everything else to { 0 } should probably be deferred until
gcc handles this without additional warnings.

Christof


More information about the samba-technical mailing list