summaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
blob: 72a8d52d92d79ee7b35b4066017b66a69e6f2921 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- a/bsd-user/freebsd/os-sys.c
+++ b/bsd-user/freebsd/os-sys.c
@@ -165,7 +165,9 @@ abi_long do_freebsd_sysctl(CPUArchState 
         switch (snamep[1]) {
         case KERN_USRSTACK:
 #if TARGET_USRSTACK != 0
-            (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
+            if (oldlen) {
+                (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
+            }
             holdlen = sizeof(abi_ulong);
             ret = 0;
 #else
@@ -175,7 +177,9 @@ abi_long do_freebsd_sysctl(CPUArchState 
 
         case KERN_PS_STRINGS:
 #if defined(TARGET_PS_STRINGS)
-            (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
+            if (oldlen) {
+                (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
+            }
             holdlen = sizeof(abi_ulong);
             ret = 0;
 #else