Received: from eggs.gnu.org ([2001:4830:134:3::10]:44404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkDrK-00065j-8p for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:12:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xk778-0002jN-4U for qemu-devel@nongnu.org; Fri, 31 Oct 2014 03:59:23 -0400 Message-ID: <5453412E.9020601@huawei.com> Date: Fri, 31 Oct 2014 15:58:38 +0800 From: Gonglei MIME-Version: 1.0 References: <5453178B.2040504@huawei.com> <54533742.1000109@msgid.tls.msk.ru> <54533B60.2080008@huawei.com> <54533D41.6010704@msgid.tls.msk.ru> In-Reply-To: <54533D41.6010704@msgid.tls.msk.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/4] pidfile: stop making pidfile error a special case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: "qemu-trivial@nongnu.org" , "qemu-devel@nongnu.org" , Markus Armbruster On 2014/10/31 15:41, Michael Tokarev wrote: > 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' Ok. That's will be great if you can modify it to "(len == 1 && status == 0 ) ? 0 : 1" Best regards, -Gonglei > 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