diff options
author | jhb <jhb@FreeBSD.org> | 2003-03-12 20:17:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-03-12 20:17:40 +0000 |
commit | 954b82f2939d07398bf3694f232cf8b4175eeccc (patch) | |
tree | e2fb2c7cc8f44fdc31a2ade1965ab9eccfc13794 /sys/kern/kern_proc.c | |
parent | 916c3f08475c62736c424976a9a39eeb29d175b7 (diff) | |
download | FreeBSD-src-954b82f2939d07398bf3694f232cf8b4175eeccc.zip FreeBSD-src-954b82f2939d07398bf3694f232cf8b4175eeccc.tar.gz |
- Various little style fixes.
- If SYSCTL_OUT() fails in sysctl_kern_proc_args(), return the error
instead of ignoring it if we have new arguments for the process.
- If the new arguments for a process are too long, return ENOMEM instead of
returning success but not doing the actual copy.
Submitted by: bde
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r-- | sys/kern/kern_proc.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index bbd080e..84b3fc1 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1024,8 +1024,8 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) { int *name = (int*) arg1; u_int namelen = arg2; + struct pargs *newpa, *pa; struct proc *p; - struct pargs *pa, *newpa; int error = 0; if (namelen != 1) @@ -1048,23 +1048,20 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) pa = p->p_args; pargs_hold(pa); PROC_UNLOCK(p); - if (req->oldptr && pa != NULL) { + if (req->oldptr != NULL && pa != NULL) error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length); - } pargs_drop(pa); - if (req->newptr == NULL) + if (error != 0 || req->newptr == NULL) return (error); if (req->newlen + sizeof(struct pargs) > ps_arg_cache_limit) - return (error); - + return (ENOMEM); newpa = pargs_alloc(req->newlen); error = SYSCTL_IN(req, newpa->ar_args, req->newlen); - if (error) { + if (error != 0) { pargs_free(newpa); return (error); } - PROC_LOCK(p); pa = p->p_args; p->p_args = newpa; |