Fix a stupid bug where I wasn't initializing the names

of 0-length mount options.
This commit is contained in:
Maxime Henrion 2002-07-24 19:50:00 +00:00
parent ef594d3186
commit dae0abedbd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100631

View file

@ -226,21 +226,22 @@ vfs_buildopts(struct uio *auio, struct vfsoptlist **options)
namelen = auio->uio_iov[i].iov_len;
optlen = auio->uio_iov[i + 1].iov_len;
opt->name = malloc(namelen, M_MOUNT, M_WAITOK);
opt->len = optlen;
if (optlen == 0) {
opt->value = NULL;
opt->value = NULL;
if (auio->uio_segflg == UIO_SYSSPACE) {
bcopy(auio->uio_iov[i].iov_base, opt->name, namelen);
} else {
error = copyin(auio->uio_iov[i].iov_base, opt->name,
namelen);
if (error)
goto bad;
}
opt->len = optlen;
if (optlen != 0) {
opt->value = malloc(optlen, M_MOUNT, M_WAITOK);
if (auio->uio_segflg == UIO_SYSSPACE) {
bcopy(auio->uio_iov[i].iov_base, opt->name,
namelen);
bcopy(auio->uio_iov[i + 1].iov_base, opt->value,
optlen);
} else {
error = copyin(auio->uio_iov[i].iov_base,
opt->name, namelen);
if (error)
goto bad;
error = copyin(auio->uio_iov[i + 1].iov_base,
opt->value, optlen);
if (error)