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

[Xen-devel] [PATCH 2/2 v2] xenstore: check F_SETFL fcntl invocation in setnonblock



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.

Thanks,
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®.