]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
errno not be set on RPC errors nfs-utils-1-2-1-rc2
authorSteve Dickson <steved@redhat.com>
Wed, 15 Jul 2009 11:58:22 +0000 (07:58 -0400)
committerSteve Dickson <steved@redhat.com>
Wed, 15 Jul 2009 11:58:22 +0000 (07:58 -0400)
Changed both nfs_advise_umount() and nfs_gp_ping() to
set the errno by calling CLNT_GETERR() after a CLNT_CALL()
error. Also added code to rpc_strerror() that will log
the errno value, when set, via strerror().

These changes added essential information to the error message
making it much easier to detect errorsuch as "Connection refused"

Signed-off-by: Steve Dickson <steved@redhat.com>
support/nfs/getport.c
utils/mount/error.c
utils/mount/network.c

index 4d4b1c446b6c755c0eec56193aa122ab20614ccb..4bdf556e092fc5e3e33dea26b87bf1a0b3dab128 100644 (file)
@@ -398,6 +398,10 @@ static int nfs_gp_ping(CLIENT *client, struct timeval timeout)
                           (xdrproc_t)xdr_void, NULL,
                           timeout);
 
                           (xdrproc_t)xdr_void, NULL,
                           timeout);
 
+       if (status != RPC_SUCCESS) {
+               rpc_createerr.cf_stat = status;
+               CLNT_GETERR(client, &rpc_createerr.cf_error);
+       }
        return (int)(status == RPC_SUCCESS);
 }
 
        return (int)(status == RPC_SUCCESS);
 }
 
@@ -530,7 +534,7 @@ static unsigned long nfs_gp_pmap_getport(CLIENT *client,
 
        if (status != RPC_SUCCESS) {
                rpc_createerr.cf_stat = status;
 
        if (status != RPC_SUCCESS) {
                rpc_createerr.cf_stat = status;
-               clnt_geterr(client, &rpc_createerr.cf_error);
+               CLNT_GETERR(client, &rpc_createerr.cf_error);
                port = 0;
        } else if (port == 0)
                rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
                port = 0;
        } else if (port == 0)
                rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
index 4cc9e0949e3645dbbd6b17c077161e3adb5ab2f5..1b64bd7fb1c9d4267ff88646b5836f4335b4bac4 100644 (file)
@@ -70,9 +70,15 @@ static int rpc_strerror(int spos)
                        pos = snprintf(tmp, (erreob - tmp),
                                        _("System Error: %s"),
                                                strerror(cf_errno));
                        pos = snprintf(tmp, (erreob - tmp),
                                        _("System Error: %s"),
                                                strerror(cf_errno));
-               else
-                       pos = snprintf(tmp, (erreob - tmp),
-                                       _("RPC Error:%s"), estr);
+               else {
+                       if (cf_errno) 
+                               pos = snprintf(tmp, (erreob - tmp),
+                                       _("RPC Error:%s; errno = %s"), 
+                                       estr, strerror(cf_errno));
+                       else
+                               pos = snprintf(tmp, (erreob - tmp),
+                                               _("RPC Error:%s"), estr);
+               }
        }
        return pos;
 }
        }
        return pos;
 }
index 4ec7c7bc09be37291aafc4f509fc74c0465ac584..f6fa5fd340ec353d4e9cc8155569babdaeef8806 100644 (file)
@@ -848,10 +848,14 @@ int nfs_advise_umount(const struct sockaddr *sap, const socklen_t salen,
                        (xdrproc_t)xdr_dirpath, (caddr_t)argp,
                        (xdrproc_t)xdr_void, NULL,
                        timeout);
                        (xdrproc_t)xdr_dirpath, (caddr_t)argp,
                        (xdrproc_t)xdr_void, NULL,
                        timeout);
-       if (verbose && res != RPC_SUCCESS)
-               nfs_error(_("%s: UMNT call failed: %s"),
-                       progname, clnt_sperrno(res));
+       if (res != RPC_SUCCESS) {
+               rpc_createerr.cf_stat = res;
+               CLNT_GETERR(client, &rpc_createerr.cf_error);
+               if (verbose)
+                       nfs_error(_("%s: UMNT call failed: %s"),
+                               progname, clnt_sperrno(res));
 
 
+       }
        auth_destroy(client->cl_auth);
        CLNT_DESTROY(client);
 
        auth_destroy(client->cl_auth);
        CLNT_DESTROY(client);