]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/rpcmisc.c
1/ be less trusting of information in /var/lib/nfs/xtab. Add things to
[nfs-utils.git] / support / nfs / rpcmisc.c
index b994fb1361fd19e25e4296446ee128e2feccaaf2..457d642558c2c705ac0ea97a9d0a594ed5b536d1 100644 (file)
@@ -67,8 +67,9 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport,
        if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
                static SVCXPRT *last_transp = NULL;
  
-               if (_rpcfdtype == 0 && defport != 0) {
-                       if (last_transp && last_transp->xp_port == defport) {
+               if (_rpcfdtype == 0) {
+                       if (last_transp
+                           && (!defport || defport == last_transp->xp_port)) {
                                transp = last_transp;
                                goto udp_transport;
                        }
@@ -92,8 +93,9 @@ rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport,
        if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
                static SVCXPRT *last_transp = NULL;
 
-               if (_rpcfdtype == 0 && defport != 0) {
-                       if (last_transp && last_transp->xp_port == defport) {
+               if (_rpcfdtype == 0) {
+                       if (last_transp
+                           && (!defport || defport == last_transp->xp_port)) {
                                transp = last_transp;
                                goto tcp_transport;
                        }