| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mount_autofs.c,v 1.3 2018/01/23 15:02:03 wiz Exp $ */ | | 1 | /* $NetBSD: mount_autofs.c,v 1.4 2019/11/20 17:18:35 tkusumi Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Christos Zoulas. | | 8 | * by Christos Zoulas. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | #include <sys/cdefs.h> | | 31 | #include <sys/cdefs.h> |
32 | #ifndef lint | | 32 | #ifndef lint |
33 | __RCSID("$NetBSD: mount_autofs.c,v 1.3 2018/01/23 15:02:03 wiz Exp $"); | | 33 | __RCSID("$NetBSD: mount_autofs.c,v 1.4 2019/11/20 17:18:35 tkusumi Exp $"); |
34 | #endif /* not lint */ | | 34 | #endif /* not lint */ |
35 | | | 35 | |
36 | #include <sys/param.h> | | 36 | #include <sys/param.h> |
37 | #include <sys/mount.h> | | 37 | #include <sys/mount.h> |
38 | | | 38 | |
39 | #include <err.h> | | 39 | #include <err.h> |
40 | #include <unistd.h> | | 40 | #include <unistd.h> |
41 | #include <stdio.h> | | 41 | #include <stdio.h> |
42 | #include <stdlib.h> | | 42 | #include <stdlib.h> |
43 | #include <string.h> | | 43 | #include <string.h> |
44 | | | 44 | |
45 | #include <mntopts.h> | | 45 | #include <mntopts.h> |
46 | | | 46 | |
| @@ -81,27 +81,26 @@ mount_autofs_parseargs(int argc, char *a | | | @@ -81,27 +81,26 @@ mount_autofs_parseargs(int argc, char *a |
81 | break; | | 81 | break; |
82 | case 'o': | | 82 | case 'o': |
83 | mp = getmntopts(optarg, mopts, mntflags, 0); | | 83 | mp = getmntopts(optarg, mopts, mntflags, 0); |
84 | if (mp == NULL) | | 84 | if (mp == NULL) |
85 | err(EXIT_FAILURE, "getmntopts"); | | 85 | err(EXIT_FAILURE, "getmntopts"); |
86 | freemntopts(mp); | | 86 | freemntopts(mp); |
87 | break; | | 87 | break; |
88 | case 'O': | | 88 | case 'O': |
89 | strlcpy(am->master_options, optarg, MAXPATHLEN); | | 89 | strlcpy(am->master_options, optarg, MAXPATHLEN); |
90 | break; | | 90 | break; |
91 | case 'p': | | 91 | case 'p': |
92 | strlcpy(am->master_prefix, optarg, MAXPATHLEN); | | 92 | strlcpy(am->master_prefix, optarg, MAXPATHLEN); |
93 | break; | | 93 | break; |
94 | | | | |
95 | case '?': | | 94 | case '?': |
96 | default: | | 95 | default: |
97 | usage(); | | 96 | usage(); |
98 | } | | 97 | } |
99 | argc -= optind; | | 98 | argc -= optind; |
100 | argv += optind; | | 99 | argv += optind; |
101 | | | 100 | |
102 | if (argc != 2) | | 101 | if (argc != 2) |
103 | usage(); | | 102 | usage(); |
104 | | | 103 | |
105 | strlcpy(canon_dev, argv[0], MAXPATHLEN); | | 104 | strlcpy(canon_dev, argv[0], MAXPATHLEN); |
106 | if (realpath(argv[1], canon_dir) == NULL) /* Check mounton path */ | | 105 | if (realpath(argv[1], canon_dir) == NULL) /* Check mounton path */ |
107 | err(EXIT_FAILURE, "realpath %s", canon_dir); | | 106 | err(EXIT_FAILURE, "realpath %s", canon_dir); |