summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-07-03 05:14:47 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-07-03 05:14:47 +0000
commit9f940c55b62a8b4b4fd095da1ef7b5f3cb45e047 (patch)
tree46106a615bc5b38f677eebaf247825874e2dabdc /lib/libc
parente886530feffe2797b74c149e676ce5d5530b68eb (diff)
Permit old behaviour of uname(2) if new kernel variable is not available
Diffstat (limited to 'lib/libc')
-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;