diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 1b20069eafd3..91ed9d43d228 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_sysctl.c,v 1.40 1995/11/14 09:05:40 phk Exp $ + * $Id: kern_sysctl.c,v 1.41 1995/11/14 09:07:14 phk Exp $ */ /* @@ -270,19 +270,8 @@ SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD, 0, 0, sysctl_sysctl_debug, ""); char domainname[MAXHOSTNAMELEN]; -int domainnamelen; -static int -sysctl_kern_domainname SYSCTL_HANDLER_ARGS -{ - int error = sysctl_handle_string(oidp, - oidp->oid_arg1, oidp->oid_arg2, req); - if (req->newptr && (error == 0 || error == ENOMEM)) - domainnamelen = req->newlen; - return error; -} - -SYSCTL_PROC(_kern, KERN_DOMAINNAME, domainname, CTLTYPE_STRING|CTLFLAG_RW, - &domainname, sizeof(domainname), sysctl_kern_domainname, ""); +SYSCTL_STRING(_kern, KERN_DOMAINNAME, domainname, CTLFLAG_RW, + &domainname, sizeof(domainname), ""); long hostid; /* Some trouble here, if sizeof (int) != sizeof (long) */ diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index a961990f0383..fca19bc9d8ab 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 - * $Id: kern_xxx.c,v 1.17 1995/11/12 06:43:03 bde Exp $ + * $Id: kern_xxx.c,v 1.18 1995/11/12 07:04:30 bde Exp $ */ #include @@ -280,6 +280,7 @@ getdomainname(p, uap, retval) struct getdomainname_args *uap; int *retval; { + int domainnamelen = strlen(domainname) + 1; if ((u_int)uap->len > domainnamelen + 1) uap->len = domainnamelen + 1; return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len)); @@ -299,7 +300,7 @@ setdomainname(p, uap, retval) struct setdomainname_args *uap; int *retval; { - int error; + int error, domainnamelen; if ((error = suser(p->p_ucred, &p->p_acflag))) return (error);