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

Re: [Xen-devel] [PATCH v4 09/29] tools/libxl: Fix libxl__carefd_opened() to be more useful with an invalid fd



On Tue, 2015-07-14 at 14:39 +0100, Ian Jackson wrote:
> Andrew Cooper writes ("[PATCH v4 09/29] tools/libxl: Fix 
> libxl__carefd_opened() to be more useful with an invalid fd"):
> > In the case that fd is -1, preserve errno and don't attempt to set
> > CLOEXEC.
> > 
> > Note that the implementation can still fail, as it ignores fcntl()
> > errors and may not set CLOEXEC properly.  Update the documentation
> > accordingly until it is fixed.
> 
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> 
> > Fixing the fnctl() error issue involves more TUITs than I currently
> > have.
> 
> I think that if the fcntl set cloexec fails, we should probably abort
> the program.  Ian C, would that be OK with you ?  If so then the
> patch to fix this is trivial.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
suggests the only relevant failures which can occur for setting cloexec
would be EBADF or EINVAL, both of which would be program errors in this
code path and not external factors or due to other threads.

So I think an abort would be ok in this instance.

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.