summaryrefslogtreecommitdiff
path: root/lib/libc/gen/uname.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen/uname.c')
-rw-r--r--lib/libc/gen/uname.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/gen/uname.c b/lib/libc/gen/uname.c
index 05221b60056..6097eef2bba 100644
--- a/lib/libc/gen/uname.c
+++ b/lib/libc/gen/uname.c
@@ -76,8 +76,13 @@ uname(name)
mib[0] = CTL_KERN;
mib[1] = KERN_OSVERSION;
len = sizeof(name->version);
- if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1)
- rval = -1;
+ if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1) {
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_VERSION;
+ len = sizeof(name->version);
+ if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1)
+ rval = -1;
+ }
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;