| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mount.c,v 1.97 2012/06/14 00:39:33 christos Exp $ */ | | 1 | /* $NetBSD: mount.c,v 1.98 2013/01/24 17:53:49 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1989, 1993, 1994 | | 4 | * Copyright (c) 1980, 1989, 1993, 1994 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -29,27 +29,27 @@ | | | @@ -29,27 +29,27 @@ |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | #ifndef lint | | 33 | #ifndef lint |
34 | __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\ | | 34 | __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\ |
35 | The Regents of the University of California. All rights reserved."); | | 35 | The Regents of the University of California. All rights reserved."); |
36 | #endif /* not lint */ | | 36 | #endif /* not lint */ |
37 | | | 37 | |
38 | #ifndef lint | | 38 | #ifndef lint |
39 | #if 0 | | 39 | #if 0 |
40 | static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; | | 40 | static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; |
41 | #else | | 41 | #else |
42 | __RCSID("$NetBSD: mount.c,v 1.97 2012/06/14 00:39:33 christos Exp $"); | | 42 | __RCSID("$NetBSD: mount.c,v 1.98 2013/01/24 17:53:49 christos Exp $"); |
43 | #endif | | 43 | #endif |
44 | #endif /* not lint */ | | 44 | #endif /* not lint */ |
45 | | | 45 | |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | #include <sys/mount.h> | | 47 | #include <sys/mount.h> |
48 | #include <sys/wait.h> | | 48 | #include <sys/wait.h> |
49 | | | 49 | |
50 | #include <fs/puffs/puffs_msgif.h> | | 50 | #include <fs/puffs/puffs_msgif.h> |
51 | | | 51 | |
52 | #include <err.h> | | 52 | #include <err.h> |
53 | #include <errno.h> | | 53 | #include <errno.h> |
54 | #include <fstab.h> | | 54 | #include <fstab.h> |
55 | #include <pwd.h> | | 55 | #include <pwd.h> |
| @@ -194,28 +194,27 @@ main(int argc, char *argv[]) | | | @@ -194,28 +194,27 @@ main(int argc, char *argv[]) |
194 | fs->fs_mntops, !forceall, NULL, 0)) | | 194 | fs->fs_mntops, !forceall, NULL, 0)) |
195 | rval = 1; | | 195 | rval = 1; |
196 | } | | 196 | } |
197 | else { | | 197 | else { |
198 | if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) | | 198 | if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) |
199 | err(EXIT_FAILURE, "getmntinfo"); | | 199 | err(EXIT_FAILURE, "getmntinfo"); |
200 | for (i = 0; i < mntsize; i++) { | | 200 | for (i = 0; i < mntsize; i++) { |
201 | if (checkvfsname(mntbuf[i].f_fstypename, | | 201 | if (checkvfsname(mntbuf[i].f_fstypename, |
202 | vfslist)) | | 202 | vfslist)) |
203 | continue; | | 203 | continue; |
204 | prmount(&mntbuf[i]); | | 204 | prmount(&mntbuf[i]); |
205 | } | | 205 | } |
206 | } | | 206 | } |
207 | exit(rval); | | 207 | return rval; |
208 | /* NOTREACHED */ | | | |
209 | case 1: | | 208 | case 1: |
210 | if (vfslist != NULL) { | | 209 | if (vfslist != NULL) { |
211 | usage(); | | 210 | usage(); |
212 | /* NOTREACHED */ | | 211 | /* NOTREACHED */ |
213 | } | | 212 | } |
214 | | | 213 | |
215 | /* | | 214 | /* |
216 | * Create a canonical version of the device or mount path | | 215 | * Create a canonical version of the device or mount path |
217 | * passed to us. It's ok for this to fail. It's also ok | | 216 | * passed to us. It's ok for this to fail. It's also ok |
218 | * for the result to be exactly the same as the original. | | 217 | * for the result to be exactly the same as the original. |
219 | */ | | 218 | */ |
220 | canonical_path = realpath(*argv, canonical_path_buf); | | 219 | canonical_path = realpath(*argv, canonical_path_buf); |
221 | | | 220 | |
| @@ -315,28 +314,27 @@ out: | | | @@ -315,28 +314,27 @@ out: |
315 | * good news. Pid checks are probably unnecessary, but don't hurt. | | 314 | * good news. Pid checks are probably unnecessary, but don't hurt. |
316 | */ | | 315 | */ |
317 | if (rval == 0 && getuid() == 0 && | | 316 | if (rval == 0 && getuid() == 0 && |
318 | (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { | | 317 | (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { |
319 | int pid; | | 318 | int pid; |
320 | | | 319 | |
321 | if (fscanf(mountdfp, "%d", &pid) == 1 && | | 320 | if (fscanf(mountdfp, "%d", &pid) == 1 && |
322 | pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH) | | 321 | pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH) |
323 | err(EXIT_FAILURE, "signal mountd"); | | 322 | err(EXIT_FAILURE, "signal mountd"); |
324 | (void)fclose(mountdfp); | | 323 | (void)fclose(mountdfp); |
325 | } | | 324 | } |
326 | #endif | | 325 | #endif |
327 | | | 326 | |
328 | exit(rval); | | 327 | return rval; |
329 | /* NOTREACHED */ | | | |
330 | } | | 328 | } |
331 | | | 329 | |
332 | int | | 330 | int |
333 | hasopt(const char *mntopts, const char *option) | | 331 | hasopt(const char *mntopts, const char *option) |
334 | { | | 332 | { |
335 | int negative, found; | | 333 | int negative, found; |
336 | char *opt, *optbuf; | | 334 | char *opt, *optbuf; |
337 | | | 335 | |
338 | if (option[0] == 'n' && option[1] == 'o') { | | 336 | if (option[0] == 'n' && option[1] == 'o') { |
339 | negative = 1; | | 337 | negative = 1; |
340 | option += 2; | | 338 | option += 2; |
341 | } else | | 339 | } else |
342 | negative = 0; | | 340 | negative = 0; |