[klibc] [patch 01/12] avoid exit on valid usage in nfsmount

Erik van Konijnenburg ekonijn at xs4all.nl
Sun May 22 07:50:33 PDT 2005


Nfsmount_main may exit on usage errors, illegal arguments for example,
but will return rather than exit on environment errors.
This allows kinit to retry nfsmount with a different option
if nfs over tcp happens to be unsupported.

Signed-off-by: Erik van Konijnenburg <ekonijn at xs4all.nl>

Index: exec/nfsmount/mount.c
===================================================================
--- exec.orig/nfsmount/mount.c	2005-01-08 04:14:32.000000000 +0100
+++ exec/nfsmount/mount.c	2005-05-21 12:38:16.000000000 +0200
@@ -37,7 +37,7 @@
 
 #define MNT_REPLY_MINSIZE (sizeof(struct rpc_reply) + sizeof(__u32))
 
-static void get_ports(__u32 server, const struct nfs_mount_data *data)
+static int get_ports(__u32 server, const struct nfs_mount_data *data)
 {
 	__u32 nfs_ver, mount_ver;
 	__u32 proto;
@@ -61,7 +61,7 @@
 				fprintf(stderr, "NFS over TCP not "
 					"available from %s\n",
 					inet_ntoa(addr));
-				exit(1);
+				return -1;
 			}
 			nfs_port = NFS_PORT;
 		}
@@ -73,6 +73,7 @@
 		if (mount_port == 0)
 			mount_port = MOUNT_PORT;
 	}
+	return 0;
 }
 
 static inline int pad_len(int len)
@@ -249,7 +250,9 @@
 	int ret = 0;
 	int mountflags;
 
-	get_ports(server, data);
+	if (get_ports(server, data) != 0) {
+		goto bail;
+	}
 
 	dump_params(server, path, data);
 

--



More information about the klibc mailing list