diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_stat.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c index 55d14af..115c2ae 100644 --- a/sys/i386/ibcs2/ibcs2_stat.c +++ b/sys/i386/ibcs2/ibcs2_stat.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include <sys/filedesc.h> #include <sys/jail.h> #include <sys/kernel.h> +#include <sys/malloc.h> #include <sys/mount.h> #include <sys/malloc.h> #include <sys/vnode.h> @@ -108,16 +109,18 @@ ibcs2_statfs(td, uap) struct thread *td; struct ibcs2_statfs_args *uap; { - struct statfs sf; + struct statfs *sf; char *path; int error; CHECKALTEXIST(td, uap->path, &path); - error = kern_statfs(td, path, UIO_SYSSPACE, &sf); + sf = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK); + error = kern_statfs(td, path, UIO_SYSSPACE, sf); free(path, M_TEMP); - if (error) - return (error); - return cvt_statfs(&sf, (caddr_t)uap->buf, uap->len); + if (error == 0) + error = cvt_statfs(sf, (caddr_t)uap->buf, uap->len); + free(sf, M_STATFS); + return (error); } int @@ -125,13 +128,15 @@ ibcs2_fstatfs(td, uap) struct thread *td; struct ibcs2_fstatfs_args *uap; { - struct statfs sf; + struct statfs *sf; int error; - error = kern_fstatfs(td, uap->fd, &sf); - if (error) - return (error); - return cvt_statfs(&sf, (caddr_t)uap->buf, uap->len); + sf = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK); + error = kern_fstatfs(td, uap->fd, sf); + if (error == 0) + error = cvt_statfs(sf, (caddr_t)uap->buf, uap->len); + free(sf, M_STATFS); + return (error); } int |