Author: markj
Date: Thu Mar 26 15:02:56 2020
New Revision: 359331
URL: https://svnweb.freebsd.org/changeset/base/359331

Log:
  Simplify td_ucred handling in newnfs_connect().
  
  No functional change intended.
  
  MFC after:    1 week

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c    Thu Mar 26 15:02:37 2020        
(r359330)
+++ head/sys/fs/nfs/nfs_commonkrpc.c    Thu Mar 26 15:02:56 2020        
(r359331)
@@ -233,10 +233,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
        saddr = NFSSOCKADDR(nrp->nr_nam, struct sockaddr *);
        error = socreate(saddr->sa_family, &so, nrp->nr_sotype, 
            nrp->nr_soproto, td->td_ucred, td);
-       if (error) {
-               td->td_ucred = origcred;
+       if (error != 0)
                goto out;
-       }
        do {
            if (error != 0 && pktscale > 2) {
                if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM &&
@@ -272,10 +270,8 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
                    " rsize, wsize\n");
        } while (error != 0 && pktscale > 2);
        soclose(so);
-       if (error) {
-               td->td_ucred = origcred;
+       if (error != 0)
                goto out;
-       }
 
        client = clnt_reconnect_create(nconf, saddr, nrp->nr_prog,
            nrp->nr_vers, sndreserve, rcvreserve);
@@ -423,11 +419,10 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq
                        mtx_unlock(&nrp->nr_mtx);
        }
 
-
+out:
        /* Restore current thread's credentials. */
        td->td_ucred = origcred;
 
-out:
        NFSEXITCODE(error);
        return (error);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to