nfs_error() reports the wrong error message because close(2) tromps on
the errno set by getsockname(2).  Also, the existing logic returned
error status only if verbose was set.

As an added bonus, clarify the error message.

Signed-off-by: Chuck Lever <[EMAIL PROTECTED]>
---

 utils/mount/network.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index ee8aa28..9f8d1d4 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -883,12 +883,10 @@ int get_client_address(struct sockaddr_in *saddr, struct 
sockaddr_in *caddr)
                return 0;
 
        err = getsockname(socket, caddr, &len);
-       close(socket);
-
-       if (err && verbose) {
-               nfs_error(_("%s: getsockname failed: %s"),
+       if (err && verbose)
+               nfs_error(_("%s: error acquiring client's local address: %s"),
                                progname, strerror(errno));
-               return 0;
-       }
-       return 1;
+
+       close(socket);
+       return err ? 0 : 1;
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to