summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/compat/svr4/svr4_stat.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index c7dc4d870a7..1b785dff2d9 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_stat.c,v 1.8 1996/05/02 13:06:33 deraadt Exp $ */
+/* $OpenBSD: svr4_stat.c,v 1.9 1997/10/08 14:57:31 kstailey Exp $ */
/* $NetBSD: svr4_stat.c,v 1.21 1996/04/22 01:16:07 christos Exp $ */
/*
@@ -399,7 +399,7 @@ svr4_sys_uname(p, v, retval)
struct svr4_sys_uname_args *uap = v;
struct svr4_utsname sut;
extern char ostype[], hostname[], osrelease[], version[], machine[];
-
+ char *cp, *dp, *ep;
bzero(&sut, sizeof(sut));
@@ -412,8 +412,17 @@ svr4_sys_uname(p, v, retval)
strncpy(sut.release, osrelease, sizeof(sut.release));
sut.release[sizeof(sut.release) - 1] = '\0';
- strncpy(sut.version, version, sizeof(sut.version));
- sut.version[sizeof(sut.version) - 1] = '\0';
+ dp = sut.version;
+ ep = &sut.version[sizeof(sut.version) - 1];
+ for (cp = version; *cp && *cp != '('; cp++)
+ ;
+ for (cp++; *cp && *cp != ')' && dp < ep; cp++)
+ *dp++ = *cp;
+ for (; *cp && *cp != '#'; cp++)
+ ;
+ for (; *cp && *cp != ':' && dp < ep; cp++)
+ *dp++ = *cp;
+ *dp = '\0';
strncpy(sut.machine, machine, sizeof(sut.machine));
sut.machine[sizeof(sut.machine) - 1] = '\0';