Fix an error in r281551, part of the getfsstat() / kern_getfsstat()

rework.  The number of entries was supposed to be returned to the user,
not used as a scratch variable.

This broke RELENG_4 jails starting up on current systems.
This commit is contained in:
peter 2015-05-05 05:14:12 +00:00
parent 38e035555c
commit ec163c3dc9

View File

@ -248,7 +248,7 @@ freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfss
{ {
struct statfs *buf, *sp; struct statfs *buf, *sp;
struct statfs32 stat32; struct statfs32 stat32;
size_t count, size; size_t count, size, copycount;
int error; int error;
count = uap->bufsize / sizeof(struct statfs32); count = uap->bufsize / sizeof(struct statfs32);
@ -256,12 +256,13 @@ freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfss
error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags); error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags);
if (size > 0) { if (size > 0) {
sp = buf; sp = buf;
while (count > 0 && error == 0) { copycount = count;
while (copycount > 0 && error == 0) {
copy_statfs(sp, &stat32); copy_statfs(sp, &stat32);
error = copyout(&stat32, uap->buf, sizeof(stat32)); error = copyout(&stat32, uap->buf, sizeof(stat32));
sp++; sp++;
uap->buf++; uap->buf++;
count--; copycount--;
} }
free(buf, M_TEMP); free(buf, M_TEMP);
} }