summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1997-08-09 12:59:15 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1997-08-09 12:59:15 +0000
commitba3c066854b71d1c216a711c26b604cd88253d68 (patch)
tree2c10a80ee9142d866d0399bb2d6071ab5624f616 /sbin
parent1c66e6c37d01416c6e7407f372e6cbb6dff4a6c3 (diff)
struct statfs uses a signed short f_flags field. This field is used in
the long (the type) expression that makes up the mount flags field passed to mount(2). If we are dealing with a noatime mount this means sign extension will occur and the flag field will get messed up. I.e. noatime mounts (at least rw ones) ended up not exportable. I fixed this by casting to u_short in the expressions, but I would like to change struct statfs instead, but that is an API issue it is not for me to decide on. I also added error decoding in two syslog calls. This was made possible by the arglist heuristics printout of OpenBSD/alpha DDB :-)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/mountd/mountd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 5224a41782c..9cc4c14e0ab 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.18 1997/08/06 01:45:21 deraadt Exp $ */
+/* $OpenBSD: mountd.c,v 1.19 1997/08/09 12:59:14 niklas Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -721,9 +721,10 @@ get_exportlist()
targs.ua.fspec = NULL;
targs.ua.export.ex_flags = MNT_DELEXPORT;
if (mount(fsp->f_fstypename, fsp->f_mntonname,
- fsp->f_flags | MNT_UPDATE,
+ (u_short)fsp->f_flags | MNT_UPDATE,
(caddr_t)&targs) < 0)
- syslog(LOG_ERR, "Can't delete exports for %s",
+ syslog(LOG_ERR,
+ "Can't delete exports for %s: %m",
fsp->f_mntonname);
}
fsp++;
@@ -1650,7 +1651,8 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb)
* exportable file systems and not just MOUNT_FFS.
*/
while (mount(fsb->f_fstypename, dirp,
- fsb->f_flags | MNT_UPDATE, (caddr_t)&args) < 0) {
+ (u_short)fsb->f_flags | MNT_UPDATE, (caddr_t)&args) <
+ 0) {
if (cp)
*cp-- = savedc;
else
@@ -1682,7 +1684,7 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb)
if (cp == dirp) {
if (debug)
fprintf(stderr, "mnt unsucc\n");
- syslog(LOG_ERR, "Can't export %s", dirp);
+ syslog(LOG_ERR, "Can't export %s: %m", dirp);
return (2);
}
savedc = *cp;