diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-08-20 07:12:01 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-08-20 07:12:01 +0000 |
commit | 3a97ef39bec2a652df753888bc9572421951e966 (patch) | |
tree | 6a9e9c0fb498fbf6fc26ebc26c0d3b4e2836d9e7 /sbin/mount_nfs | |
parent | 785be6d012679b9dc4b091c5e0eb549c1aeddfab (diff) |
Unbreak processing of options when given a command line with multiple
-o options. All of them are relevant, not only the last one.
ok miod@ claudio@ marius@
Diffstat (limited to 'sbin/mount_nfs')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 151 |
1 files changed, 75 insertions, 76 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index cafec5bc191..70312d94e96 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_nfs.c,v 1.40 2004/07/16 00:11:10 henning Exp $ */ +/* $OpenBSD: mount_nfs.c,v 1.41 2004/08/20 07:12:00 otto Exp $ */ /* $NetBSD: mount_nfs.c,v 1.12.4.1 1996/05/25 22:48:05 fvdl Exp $ */ /* @@ -255,6 +255,80 @@ main(int argc, char *argv[]) break; case 'o': options = optarg; + while (options != NULL) { + switch (getmntopt(&options, &value, mopts, + &mntflags)) { + case ALTF_BG: + opflags |= BGRND; + break; + case ALTF_NOCONN: + nfsargsp->flags |= NFSMNT_NOCONN; + break; + case ALTF_DUMBTIMR: + nfsargsp->flags |= NFSMNT_DUMBTIMR; + break; + case ALTF_INTR: + nfsargsp->flags |= NFSMNT_INT; + break; + case ALTF_NFSV3: + if (force2) + errx(1, + "conflicting version options"); + force3 = 1; + break; + case ALTF_NFSV2: + if (force3) + errx(1, + "conflicting version options"); + force2 = 1; + nfsargsp->flags &= ~NFSMNT_NFSV3; + break; + case ALTF_RDIRPLUS: + nfsargsp->flags |= NFSMNT_RDIRPLUS; + break; + case ALTF_MNTUDP: + mnttcp_ok = 0; + break; + case ALTF_RESVPORT: + nfsargsp->flags |= NFSMNT_RESVPORT; + break; + case ALTF_SOFT: + nfsargsp->flags |= NFSMNT_SOFT; + break; + case ALTF_TCP: + nfsargsp->sotype = SOCK_STREAM; + nfsproto = IPPROTO_TCP; + break; + case ALTF_PORT: + port_no = value.ival; + break; + case ALTF_NOAC: + nfsargsp->flags |= (NFSMNT_ACREGMIN | + NFSMNT_ACREGMAX | NFSMNT_ACDIRMIN | + NFSMNT_ACDIRMAX); + nfsargsp->acregmin = 0; + nfsargsp->acregmax = 0; + nfsargsp->acdirmin = 0; + nfsargsp->acdirmax = 0; + break; + case ALTF_ACREGMIN: + nfsargsp->flags |= NFSMNT_ACREGMIN; + nfsargsp->acregmin = value.ival; + break; + case ALTF_ACREGMAX: + nfsargsp->flags |= NFSMNT_ACREGMAX; + nfsargsp->acregmax = value.ival; + break; + case ALTF_ACDIRMIN: + nfsargsp->flags |= NFSMNT_ACDIRMIN; + nfsargsp->acdirmin = value.ival; + break; + case ALTF_ACDIRMAX: + nfsargsp->flags |= NFSMNT_ACDIRMAX; + nfsargsp->acdirmax = value.ival; + break; + } + } break; case 'P': nfsargsp->flags |= NFSMNT_RESVPORT; @@ -313,81 +387,6 @@ main(int argc, char *argv[]) if (argc != 2) usage(); - /* parse -o options */ - while (options != NULL) { - switch (getmntopt(&options, &value, mopts, &mntflags)) { - case ALTF_BG: - opflags |= BGRND; - break; - case ALTF_NOCONN: - nfsargsp->flags |= NFSMNT_NOCONN; - break; - case ALTF_DUMBTIMR: - nfsargsp->flags |= NFSMNT_DUMBTIMR; - break; - case ALTF_INTR: - nfsargsp->flags |= NFSMNT_INT; - break; - case ALTF_NFSV3: - if (force2) - errx(1, - "conflicting version options"); - force3 = 1; - break; - case ALTF_NFSV2: - if (force3) - errx(1, - "conflicting version options"); - force2 = 1; - nfsargsp->flags &= ~NFSMNT_NFSV3; - break; - case ALTF_RDIRPLUS: - nfsargsp->flags |= NFSMNT_RDIRPLUS; - break; - case ALTF_MNTUDP: - mnttcp_ok = 0; - break; - case ALTF_RESVPORT: - nfsargsp->flags |= NFSMNT_RESVPORT; - break; - case ALTF_SOFT: - nfsargsp->flags |= NFSMNT_SOFT; - break; - case ALTF_TCP: - nfsargsp->sotype = SOCK_STREAM; - nfsproto = IPPROTO_TCP; - break; - case ALTF_PORT: - port_no = value.ival; - break; - case ALTF_NOAC: - nfsargsp->flags |= (NFSMNT_ACREGMIN | - NFSMNT_ACREGMAX | NFSMNT_ACDIRMIN | - NFSMNT_ACDIRMAX); - nfsargsp->acregmin = 0; - nfsargsp->acregmax = 0; - nfsargsp->acdirmin = 0; - nfsargsp->acdirmax = 0; - break; - case ALTF_ACREGMIN: - nfsargsp->flags |= NFSMNT_ACREGMIN; - nfsargsp->acregmin = value.ival; - break; - case ALTF_ACREGMAX: - nfsargsp->flags |= NFSMNT_ACREGMAX; - nfsargsp->acregmax = value.ival; - break; - case ALTF_ACDIRMIN: - nfsargsp->flags |= NFSMNT_ACDIRMIN; - nfsargsp->acdirmin = value.ival; - break; - case ALTF_ACDIRMAX: - nfsargsp->flags |= NFSMNT_ACDIRMAX; - nfsargsp->acdirmax = value.ival; - break; - } - } - spec = *argv++; if (realpath(*argv, name) == NULL) err(1, "realpath %s", name); |