Skip to content

Commit

Permalink
Bug fix for hw.machine and hw.machine_arch sysctl's.
Browse files Browse the repository at this point in the history
For a NULL buffer sysctl needs to return just the length of the buffer.
  • Loading branch information
staceyson committed Nov 26, 2014
1 parent cab0d36 commit 8267ad2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bsd-user/freebsd/os-sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,16 @@ abi_long do_freebsd_sysctl(CPUArchState *env, abi_ulong namep, int32_t namelen,
case CTL_HW:
switch (snamep[1]) {
case HW_MACHINE:
strlcpy(holdp, TARGET_HW_MACHINE, oldlen);
holdlen = sizeof(TARGET_HW_MACHINE);
if (holdp)
strlcpy(holdp, TARGET_HW_MACHINE, oldlen);
ret = 0;
goto out;

case HW_MACHINE_ARCH:
strlcpy(holdp, TARGET_HW_MACHINE_ARCH, oldlen);
holdlen = sizeof(TARGET_HW_MACHINE_ARCH);
if (holdp)
strlcpy(holdp, TARGET_HW_MACHINE_ARCH, oldlen);
ret = 0;
goto out;

Expand Down

0 comments on commit 8267ad2

Please sign in to comment.