[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2 v2] xenstore: check F_SETFL fcntl invocation in setnonblock
On Mon, 2013-12-02 at 11:36 +0000, Ian Jackson wrote: > Matthew Daley writes ("[PATCH 2/2 v2] xenstore: check F_SETFL fcntl > invocation in setnonblock"): > > ...and check the newly-added result of setnonblock itself where used. > ... > > -static void setnonblock(int fd, int nonblock) { > > - int esave = errno; > > +static bool setnonblock(int fd, int nonblock) { > > int flags = fcntl(fd, F_GETFL); > > if (flags == -1) > > - goto out; > > + return false; > > > > if (nonblock) > > flags |= O_NONBLOCK; > > else > > flags &= ~O_NONBLOCK; > > > > - fcntl(fd, F_SETFL, flags); > > -out: > > - errno = esave; > > + return fcntl(fd, F_SETFL, flags) != -1; > > fcntl F_SETFL returns 0 on success and -1 or error. But your > setnonblock is supposed to return 1 on success and 0 on error. The trailing "!= -1" should make the the case, shouldn't it? Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |