[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 10:41:53 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.8.1 |
31.10.2014 10:33, Gonglei wrote:
[]
>>>> While at it, fix wrong identation in os_daemonize().
>>>
>>> s/identation/identification/
>>
>> No, the original word was the right one.
>
> Sorry, I can't find 'identation' both dictionary and Google.
> Your meaning 'indentation'?
Damn. I missed that one. It is "indentation" inedeed :)
(but not identification).
[]
>>>> do {
>>>> len = read(fds[0], &status, 1);
>>>> } while (len < 0 && errno == EINTR);
>>>> - if (len != 1) {
>>>> - exit(1);
>>>> - }
>>>
>>> Does this check need to be removed?
>>
>> Yes, because...
>>>
>>>> - else if (status == 1) {
>>>> - fprintf(stderr, "Could not acquire pidfile\n");
>>>> - exit(1);
>>>> - } else {
>>>> - exit(0);
>>>> - }
>>>> - } else if (pid < 0) {
>>>> - exit(1);
>>>> - }
>>>> +
>>>> + 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'
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
Thanks,
/mjt
- [Qemu-trivial] [PATCH 0/4] cleanup -daemonize and pidfile creation a bit, Michael Tokarev, 2014/10/31
- [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case,
Michael Tokarev <=
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Michael Tokarev, 2014/10/31
- Re: [Qemu-trivial] [PATCH 3/4] pidfile: stop making pidfile error a special case, Gonglei, 2014/10/31
[Qemu-trivial] [PATCH 1/4] os-posix: use global daemon_pipe instead of cryptic fds[1], Michael Tokarev, 2014/10/31
[Qemu-trivial] [PATCH 4/4] os-posix: reorder parent notification for -daemonize, Michael Tokarev, 2014/10/31
[Qemu-trivial] [PATCH 2/4] os-posix: replace goto again with a proper loop, Michael Tokarev, 2014/10/31