summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2006-12-07 03:24:43 +0000
committerrodrigc <rodrigc@FreeBSD.org>2006-12-07 03:24:43 +0000
commitcc385857df0ce7b301d4ddb72799aa8d01d56003 (patch)
tree8b8110c734b8d6bc6973ee86fd4ab2a6048d6733 /sbin/mount
parentfbf224913d300a2697d1ab841d44e70e6c3813ad (diff)
downloadFreeBSD-src-cc385857df0ce7b301d4ddb72799aa8d01d56003.zip
FreeBSD-src-cc385857df0ce7b301d4ddb72799aa8d01d56003.tar.gz
Pass a char buffer parameter with name "errmsg" to nmount().
For filesystems which use vfs_mount_error() to log an error, this char buffer will be populated with a string error message. If nmount() fails, in addition to printing out strerror(errno), print out the "errmsg" populated by vfs_mount_error().
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount_fs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/mount/mount_fs.c b/sbin/mount/mount_fs.c
index d9b0b3c..6ab15a3 100644
--- a/sbin/mount/mount_fs.c
+++ b/sbin/mount/mount_fs.c
@@ -84,10 +84,12 @@ mount_fs(const char *vfstype, int argc, char *argv[])
int ch;
char *dev, *dir, mntpath[MAXPATHLEN];
char fstype[32];
+ char errmsg[255];
char *p, *val;
int ret;
strncpy(fstype, vfstype, sizeof(fstype));
+ memset(errmsg, 0, sizeof(errmsg));
getmnt_silent = 1;
iov = NULL;
@@ -126,10 +128,11 @@ mount_fs(const char *vfstype, int argc, char *argv[])
build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1);
build_iovec(&iov, &iovlen, "from", dev, (size_t)-1);
+ build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
ret = nmount(iov, iovlen, mntflags);
if (ret < 0)
- err(1, "%s", dev);
+ err(1, "%s %s", dev, errmsg);
return (ret);
}
OpenPOWER on IntegriCloud