diff --git a/sys/kern/kern_systrace.c b/sys/kern/kern_systrace.c index 2cc17d96c725..ffebc8ef6d8a 100644 --- a/sys/kern/kern_systrace.c +++ b/sys/kern/kern_systrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_systrace.c,v 1.51 2006/03/01 12:38:21 yamt Exp $ */ +/* $NetBSD: kern_systrace.c,v 1.52 2006/03/18 17:44:13 chris Exp $ */ /* * Copyright 2002, 2003 Niels Provos @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.51 2006/03/01 12:38:21 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_systrace.c,v 1.52 2006/03/18 17:44:13 chris Exp $"); #include "opt_systrace.h" @@ -1461,6 +1461,11 @@ systrace_scriptname(struct proc *p, char *dst) systrace_lock(); strp = p->p_systrace; + if (strp == NULL) { + systrace_unlock(); + return (EINVAL); + } + fst = strp->parent; SYSTRACE_LOCK(fst, curlwp); @@ -1473,16 +1478,14 @@ systrace_scriptname(struct proc *p, char *dst) goto out; } - if (strp != NULL) { - if (strp->scriptname[0] == '\0') { - error = ENOENT; - goto out; - } - - strlcpy(dst, strp->scriptname, MAXPATHLEN); - strp->isscript = 1; + if (strp->scriptname[0] == '\0') { + error = ENOENT; + goto out; } + strlcpy(dst, strp->scriptname, MAXPATHLEN); + strp->isscript = 1; + out: strp->scriptname[0] = '\0'; SYSTRACE_UNLOCK(fst, curlwp);