walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
bbc1dcf
commit 52dff26c60c07cf1b4fbf8fbd3a1eab7ba90405f
bbc1dcf
Author: Chuck Lever <chuck.lever@oracle.com>
bbc1dcf
Date:   Fri Jun 6 15:07:24 2008 -0400
bbc1dcf
bbc1dcf
    Fix error reporting when probe_bothports() fails while rewriting mount
bbc1dcf
    options.
bbc1dcf
    
bbc1dcf
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
bbc1dcf
    Signed-off-by: Steve Dickson <steved@redhat.com>
bbc1dcf
bbc1dcf
diff --git a/utils/mount/error.c b/utils/mount/error.c
bbc1dcf
index 23a91ff..147e919 100644
bbc1dcf
--- a/utils/mount/error.c
bbc1dcf
+++ b/utils/mount/error.c
bbc1dcf
@@ -227,6 +227,9 @@ void mount_error(const char *spec, const char *mount_point, int error)
bbc1dcf
 			nfs_error(_("%s: mount point %s does not exist"),
bbc1dcf
 				progname, mount_point);
bbc1dcf
 		break;
bbc1dcf
+	case ESPIPE:
bbc1dcf
+		rpc_mount_errors((char *)spec, 0, 0);
bbc1dcf
+		break;
bbc1dcf
 	case EIO:
bbc1dcf
 	case EFAULT:
bbc1dcf
 		nfs_error(_("%s: internal error"), progname);
bbc1dcf
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
bbc1dcf
index 3564f15..967fd69 100644
bbc1dcf
--- a/utils/mount/stropts.c
bbc1dcf
+++ b/utils/mount/stropts.c
bbc1dcf
@@ -356,6 +356,8 @@ static struct mount_options *rewrite_mount_options(char *str)
bbc1dcf
 	clnt_addr_t nfs_server = { };
bbc1dcf
 	int p;
bbc1dcf
 
bbc1dcf
+	errno = EIO;
bbc1dcf
+
bbc1dcf
 	options = po_split(str);
bbc1dcf
 	if (!options)
bbc1dcf
 		return NULL;
bbc1dcf
@@ -426,7 +428,7 @@ static struct mount_options *rewrite_mount_options(char *str)
bbc1dcf
 	po_remove_all(options, "udp");
bbc1dcf
 
bbc1dcf
 	if (!probe_bothports(&mnt_server, &nfs_server)) {
bbc1dcf
-		rpc_mount_errors("rpcbind", 0, 0);
bbc1dcf
+		errno = ESPIPE;
bbc1dcf
 		goto err;
bbc1dcf
 	}
bbc1dcf
 
bbc1dcf
@@ -452,6 +454,7 @@ static struct mount_options *rewrite_mount_options(char *str)
bbc1dcf
 
bbc1dcf
 	}
bbc1dcf
 
bbc1dcf
+	errno = 0;
bbc1dcf
 	return options;
bbc1dcf
 
bbc1dcf
 err:
bbc1dcf
@@ -498,10 +501,8 @@ static int nfs_retry_nfs23mount(struct nfsmount_info *mi)
bbc1dcf
 	char **extra_opts = mi->extra_opts;
bbc1dcf
 
bbc1dcf
 	retry_options = rewrite_mount_options(*extra_opts);
bbc1dcf
-	if (!retry_options) {
bbc1dcf
-		errno = EIO;
bbc1dcf
+	if (!retry_options)
bbc1dcf
 		return 0;
bbc1dcf
-	}
bbc1dcf
 
bbc1dcf
 	if (po_join(retry_options, &retry_str) == PO_FAILED) {
bbc1dcf
 		po_destroy(retry_options);