From: Ian Campbell Subject: Re: [PATCH] libxl_qmp: Handle unexpected end-of-socket Date: Mon, 20 Feb 2012 17:23:01 +0000 Message-ID: <1329758581.3990.82.camel@zakaz.uk.xensource.com> References: <1326987322-28007-1-git-send-email-anthony.perard@citrix.com> <20290.32335.668762.730080@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20290.32335.668762.730080@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Anthony Perard , Xen Devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, 2012-02-20 at 17:09 +0000, Ian Jackson wrote: > Anthony PERARD writes ("[Xen-devel] [PATCH] libxl_qmp: Handle unexpected end-of-socket"): > > When read() return 0, the current code just tries again. But this leads to an > > infinite loop if QEMU died too soon. > > Right. > > > Also, retry select if a signal was caught. > > Why add another goto ? I think these goto-based loops are a bad idea, > really. > > > + if (errno == EINTR) > > + goto do_select_again; > > I think this could be "continue". Do you agree. Also select(2) says: On error, -1 is returned, and errno is set appropriately; the sets and timeout become undefined, so do not rely on their contents after an error. So by my reading you need to reinitialise the sets anyway. Ian.