From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH 03 of 24] xenpaging: use PERROR to print errno Date: Tue, 4 Oct 2011 19:19:30 +0200 Message-ID: <20111004171929.GA15455@aepfle.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: George Dunlap Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Tue, Oct 04, George Dunlap wrote: > On Mon, Oct 3, 2011 at 4:54 PM, Olaf Hering wrote: > >     seek_ret = lseek(fd, i << PAGE_SHIFT, SEEK_SET); > > +    if (seek_ret == -1) > > +    { > > +        ret = -errno; > > +        goto err; > > +    } > > Wouldn't it be more idiomatic to make both this check and the other > check in the function: > * check for seek_ret < 0 (rather than -1) The man page said its -1, now that I read it again it says (off_t)-1, so my change above should be updated to comply with the man page. > * make file_op() return -1 > * Let the caller read errno? (Rather than returning -errno)? Yes, I will change this in a new patch. Olaf