Subject: bug#9064: coreutils-8.12 compiler warning

From: "Joachim Schmitz" <[email-masked]>
Date: Wed, 13 Jul 2011 15:48:00 +0200

That does indeed silence my compiler and is showing the intention pretty
clear

-----Original Message-----
From: Eric Blake [mailto:[email-masked]] 
Sent: Wednesday, July 13, 2011 3:11 PM
To: Pádraig Brady
Cc: Joachim Schmitz; [email-masked]
Subject: Re: bug#9064: coreutils-8.12 compiler warning

On 07/13/2011 03:05 AM, Pádraig Brady wrote:
> On 13/07/11 08:55, Joachim Schmitz wrote:
>> I found this in mktemp.c, line344 (well, my compiler found it for me 
>> and warned about 'possible use of "=" where "==" was intended'):
>>
>>       if (!dry_run && (stdout_closed = true) && close_stream (stdout) 
>> != 0)
>>
>> Not sure whether this is bug or feature ;-)
> 
> Well it's a feature.
> We could reorganize but it would add a few more lines.

Does this avoid the warning?

if (!dry_run && ((stdout_closed = true), close_stream (stdout) != 0))

That is, using the comma operator rather than an always-true conditional
since we always want the assignment to occur at that part of the expression?

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org