[dm-devel] [PATCH] multipath -u: test socket connection in non-blocking mode

Martin Wilck mwilck at suse.com
Wed Apr 24 08:14:36 UTC 2019


On Wed, 2019-04-24 at 07:48 +0200, Hannes Reinecke wrote:
> On 4/23/19 9:32 PM, Martin Wilck wrote:
> >   
> > +/*
> > + * connect to a unix domain socket
> > + */
> > +int mpath_connect(void)
> > +{
> > +	int fd = __mpath_connect(0);
> > +
> > +	if (fd >= 0)
> > +		return fd;
> > +	errno = -fd;
> > +	return -1;
> > +}
> > +
> >   int mpath_disconnect(int fd)
> >   {
> >   	return close(fd);
> Please do away with the wrapper.
> No point in having it; rather use a consistent return value
> (ie either -1 and setting errno, or returning -errno directly).

I can't easily do away with the wrapper, as it's part of the public
libmpathcmd API, external commands may rely on its behavior. I'll
repost with -1 / errno semantics.

Martin

-- 
Dr. Martin Wilck <mwilck at suse.com>, Tel. +49 (0)911 74053 2107
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)





More information about the dm-devel mailing list