|
1 | | -/* $NetBSD: mount_ados.c,v 1.26 2007/07/14 15:57:24 dsl Exp $ */ |
| 1 | +/* $NetBSD: mount_ados.c,v 1.27 2007/07/16 17:06:52 pooka Exp $ */ |
2 | 2 |
|
3 | 3 | /* |
4 | 4 | * Copyright (c) 1994 Christopher G. Demetriou |
|
36 | 36 |
|
37 | 37 | #include <sys/cdefs.h> |
38 | 38 | #ifndef lint |
39 | | -__RCSID("$NetBSD: mount_ados.c,v 1.26 2007/07/14 15:57:24 dsl Exp $"); |
| 39 | +__RCSID("$NetBSD: mount_ados.c,v 1.27 2007/07/16 17:06:52 pooka Exp $"); |
40 | 40 | #endif /* not lint */ |
41 | 41 |
|
42 | 42 | #include <sys/param.h> |
43 | 43 | #include <sys/mount.h> |
44 | 44 | #include <sys/stat.h> |
| 45 | +#include <assert.h> |
45 | 46 | #include <err.h> |
46 | 47 | #include <grp.h> |
47 | 48 | #include <pwd.h> |
@@ -147,21 +148,21 @@ mount_ados(int argc, char **argv) |
147 | 148 | args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |
148 | 149 | } |
149 | 150 |
|
150 | | - if (mount(MOUNT_ADOSFS, dir, mntflags, &args, sizeof args) >= 0) |
151 | | - exit (0); |
| 151 | + if (mount(MOUNT_ADOSFS, dir, mntflags, &args, sizeof args) == -1) |
| 152 | + if (errno != EROFS) |
| 153 | + err(1, "%s on %s", dev, dir); |
152 | 154 |
|
153 | | - if (errno != EROFS) |
154 | | - err(1, "%s on %s", dev, dir); |
| 155 | + if (mntflags & MNT_GETARGS) { |
| 156 | + assert(errno != EROFS); |
| 157 | + printf("uid=%d, gid=%d, mask=0%o\n", args.uid, args.gid, |
| 158 | + args.mask); |
| 159 | + exit(0); |
| 160 | + } |
155 | 161 |
|
156 | 162 | mntflags |= MNT_RDONLY; |
157 | | - |
158 | 163 | if (mount(MOUNT_ADOSFS, dir, mntflags, &args, sizeof args) == -1) |
159 | 164 | err(1, "%s on %s", dev, dir); |
160 | 165 |
|
161 | | - if (mntflags & MNT_GETARGS) |
162 | | - printf("uid=%d, gid=%d, mask=0%o\n", args.uid, args.gid, |
163 | | - args.mask); |
164 | | - |
165 | 166 | exit (0); |
166 | 167 | } |
167 | 168 |
|
|
0 commit comments