From: Max Matveev Date: Tue, 13 Nov 2012 16:18:04 +0000 (-0500) Subject: authnone - respect the locks X-Git-Tag: libtirpc-0-2-3-rc4~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=103947230def2d284a1388df833a3c11cfc7d961;p=libtirpc authnone - respect the locks Don't try to unlock the lock which has not been locked. Signed-off-by: Max Matveev Signed-off-by: Steve Dickson --- diff --git a/src/auth_none.c b/src/auth_none.c index 008c589..affc92b 100644 --- a/src/auth_none.c +++ b/src/auth_none.c @@ -110,20 +110,19 @@ static bool_t authnone_marshal(AUTH *client, XDR *xdrs) { struct authnone_private *ap; - bool_t dummy; + bool_t rv = FALSE; extern mutex_t authnone_lock; assert(xdrs != NULL); + mutex_lock(&authnone_lock); ap = authnone_private; - if (ap == NULL) { - mutex_unlock(&authnone_lock); - return (FALSE); + if (ap) { + rv = (*xdrs->x_ops->x_putbytes)(xdrs, ap->marshalled_client, + ap->mcnt); } - dummy = (*xdrs->x_ops->x_putbytes)(xdrs, - ap->marshalled_client, ap->mcnt); mutex_unlock(&authnone_lock); - return (dummy); + return (rv); } /* All these unused parameters are required to keep ANSI-C from grumbling */