qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a spec


From: Michael Tokarev
Subject: Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case
Date: Fri, 31 Oct 2014 11:02:25 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.8.1

31.10.2014 10:58, Gonglei wrote:
> On 2014/10/31 15:41, Michael Tokarev wrote:
[]
>>>>>> +            exit(len == 1 && status == 0 ? 0 : 1);
>>>>
>>>> ...it is checked here, note the 'len == 1' part of the condition.
>>>
>>> If len != 1, the original code exit with 1, after your changes,
>>> it will exit with 0. Right?
>>
>> with len != 1, the condition 'len == 1 && status == 0 ? 0 : 1'
> 
> Ok. That's will be great if you can modify it
> to "(len == 1 && status == 0 ) ? 0 : 1"

Well, ? operator has lowest precedence in C, && and || is higher,
and == is even higher.  That's the basic rules of the language.
So I don't really see why... ;)

The comment however should clear all confusion, hopefully.

>> evaluates to 1.  Maybe I can add a comment here:
>>
> 
>> +            /* only exit successfully if our child actually
>> +             * wrote a one-byte zero to our pipe */
>> +            exit(len == 1 && status == 0 ? 0 : 1);
>>
>> See the result at 
>> http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches-next




reply via email to

[Prev in Thread] Current Thread [Next in Thread]