]> granicus.if.org Git - libtirpc/commitdiff
authnone - respect the locks
authorMax Matveev <makc@gmx.co.uk>
Tue, 13 Nov 2012 16:18:04 +0000 (11:18 -0500)
committerSteve Dickson <steved@redhat.com>
Tue, 13 Nov 2012 17:54:36 +0000 (12:54 -0500)
Don't try to unlock the lock which has not been locked.

Signed-off-by: Max Matveev <makc@gmx.co.uk>
Signed-off-by: Steve Dickson <steved@redhat.com>
src/auth_none.c

index 008c589998b8ba7135615dd0017038a80a41e376..affc92b99e81e98435029f8746bc67f0826690e5 100644 (file)
@@ -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 */