From a6b2640236b3ebf0ec910916d5158376adbeb960 Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Wed, 29 Nov 2006 00:46:30 +0000 Subject: [PATCH] Pass a string buffer named "errmsg" to nmount(). This will allow the NFS mount code to return a string error message in addition to returning an error integer value. Reviewed by: mohans MFC after: 1 month --- sbin/mount_nfs/mount_nfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 6907b2725b67..f6af363c9e55 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -254,7 +254,7 @@ main(int argc, char *argv[]) int mntflags, altflags, num; int iovlen; char *name, *p, *spec, *fstype; - char mntpath[MAXPATHLEN]; + char mntpath[MAXPATHLEN], errmsg[255]; mntflags = 0; altflags = 0; @@ -262,6 +262,7 @@ main(int argc, char *argv[]) nfsargsp = &nfsargs; iov = NULL; iovlen = 0; + memset(errmsg, 0, sizeof(errmsg)); fstype = strrchr(argv[0], '_'); if (fstype == NULL) @@ -469,9 +470,10 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "nfs_args", nfsargsp, sizeof(*nfsargsp)); build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, mntflags)) - err(1, "%s", mntpath); + err(1, "%s, %s", mntpath, errmsg); exit(0); }