]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/network.c
This is the second iteration of this patch. The only difference here
[nfs-utils.git] / utils / mount / network.c
index 92bba2d72667e6f6043ccea2b089dae9fb460ef9..c400dd8beec3ecec07f674be8bc9a864ea6af4bf 100644 (file)
@@ -37,6 +37,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/wait.h>
+#include <sys/stat.h>
 #include <netinet/in.h>
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
@@ -1331,6 +1332,12 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
        return 1;
 }
 
+#ifdef IPV6_SUPPORTED
+sa_family_t    config_default_family = AF_UNSPEC;
+#else
+sa_family_t    config_default_family = AF_INET;
+#endif
+
 /*
  * Returns TRUE and fills in @family if a valid NFS protocol option
  * is found, or FALSE if the option was specified with an invalid value.
@@ -1341,11 +1348,7 @@ int nfs_nfs_proto_family(struct mount_options *options,
        unsigned long protocol;
        char *option;
 
-#ifdef IPV6_SUPPORTED
-       *family = AF_UNSPEC;
-#else
-       *family = AF_INET;
-#endif
+       *family = config_default_family;
 
        switch (po_rightmost(options, nfs_transport_opttbl)) {
        case 0: /* udp */
@@ -1488,11 +1491,7 @@ int nfs_mount_proto_family(struct mount_options *options,
        unsigned long protocol;
        char *option;
 
-#ifdef HAVE_LIBTIRPC
-       *family = AF_UNSPEC;
-#else
-       *family = AF_INET;
-#endif
+       *family = config_default_family;
 
        option = po_get(options, "mountproto");
        if (option != NULL)