X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fstropts.c;h=8ee3024164caa94a9bf84fc5d8aaea942e1ae026;hb=020fc9855c69f74361a416be357fb882e80dcdd8;hp=0aa9a7586dbe6eadf877450e715844907a9aa945;hpb=78ee5f378f295e7bff24a7be41b9361f406d4f8b;p=nfs-utils.git diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 0aa9a75..8ee3024 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -666,6 +666,7 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi) case EOPNOTSUPP: case EHOSTUNREACH: case ETIMEDOUT: + case EACCES: continue; default: goto out; @@ -680,6 +681,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; @@ -715,20 +717,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; @@ -754,6 +762,7 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) case ECONNREFUSED: case EHOSTUNREACH: case ETIMEDOUT: + case EACCES: continue; default: goto out;