X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=utils%2Fmount%2Fstropts.c;h=9b4197b7f93d812958da2b4eaffd73cba5600836;hb=329c63dd7e4e76fc66e8a6058d95c59974ad7db1;hp=e09aa7c3b470e5322e5b5ebf3115f73eeed947fd;hpb=bf66c9facb8e4798c79e1286e3da2dcafeed83fb;p=nfs-utils.git diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index e09aa7c..9b4197b 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -665,6 +665,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi) case ECONNREFUSED: case EOPNOTSUPP: case EHOSTUNREACH: + case ETIMEDOUT: continue; default: goto out; @@ -679,6 +680,7 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, { struct mount_options *options = po_dup(mi->options); int result = 0; + char *extra_opts = NULL; if (!options) { errno = ENOMEM; @@ -714,20 +716,26 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi, goto out_fail; } - /* - * Update option string to be recorded in /etc/mtab. - */ - if (po_join(options, mi->extra_opts) == PO_FAILED) { + if (po_join(options, &extra_opts) == PO_FAILED) { errno = ENOMEM; goto out_fail; } if (verbose) printf(_("%s: trying text-based options '%s'\n"), - progname, *mi->extra_opts); + progname, extra_opts); result = nfs_sys_mount(mi, options); + /* + * If success, update option string to be recorded in /etc/mtab. + */ + if (result) { + free(*mi->extra_opts); + *mi->extra_opts = extra_opts; + } else + free(extra_opts); + out_fail: po_destroy(options); return result; @@ -752,6 +760,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) switch (errno) { case ECONNREFUSED: case EHOSTUNREACH: + case ETIMEDOUT: continue; default: goto out;