+ if (!nfs_construct_new_options(options, nfs_saddr, &nfs_pmap,
+ mnt_saddr, &mnt_pmap)) {
+ errno = EINVAL;
+ return 0;
+ }
+
+out:
+ errno = 0;
+ return 1;
+}
+
+/*
+ * Do the mount(2) system call.
+ *
+ * Returns TRUE if successful, otherwise FALSE.
+ * "errno" is set to reflect the individual error.
+ */
+static int nfs_sys_mount(struct nfsmount_info *mi, struct mount_options *opts)
+{
+ char *options = NULL;
+ int result;
+
+ if (po_join(opts, &options) == PO_FAILED) {
+ errno = EIO;
+ return 0;
+ }
+
+ if (mi->fake)
+ return 1;
+
+ result = mount(mi->spec, mi->node, mi->type,
+ mi->flags & ~(MS_USER|MS_USERS), options);
+ if (verbose && result) {
+ int save = errno;
+ nfs_error(_("%s: mount(2): %s"), progname, strerror(save));
+ errno = save;
+ }
+ return !result;
+}
+
+/*
+ * For "-t nfs vers=2" or "-t nfs vers=3" mounts.
+ */
+static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
+{
+ struct addrinfo *ai = mi->address;
+ struct mount_options *options = po_dup(mi->options);
+ int result = 0;
+
+ if (!options) {
+ errno = ENOMEM;
+ return result;
+ }
+
+ if (!nfs_append_addr_option(ai->ai_addr, ai->ai_addrlen, options)) {
+ errno = EINVAL;
+ goto out_fail;
+ }
+
+ if (!nfs_fix_mounthost_option(options, mi->hostname)) {
+ errno = EINVAL;
+ goto out_fail;
+ }
+ if (!mi->fake && !nfs_verify_lock_option(options)) {
+ errno = EINVAL;
+ goto out_fail;
+ }
+
+ /*
+ * Options we negotiate below may be stale by the time this
+ * file system is unmounted. In order to force umount.nfs
+ * to renegotiate with the server, only write the user-
+ * specified options, and not negotiated options, to /etc/mtab.
+ */
+ if (po_join(options, mi->extra_opts) == PO_FAILED) {
+ errno = ENOMEM;
+ goto out_fail;
+ }