summaryrefslogtreecommitdiffstats
path: root/sys/kern/exec_script.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-11-19 21:19:15 +0000
committertedu <tedu@openbsd.org>2014-11-19 21:19:15 +0000
commit57e3241ea1855c7e8109ca2378799aafc75d16fe (patch)
tree78397854893f30e42f6bc67224d829f343e8fddd /sys/kern/exec_script.c
parentmissed a file when removing KERN_VNODE. (diff)
downloadwireguard-openbsd-57e3241ea1855c7e8109ca2378799aafc75d16fe.tar.xz
wireguard-openbsd-57e3241ea1855c7e8109ca2378799aafc75d16fe.zip
panic should be reserved for unrecoverable errors, not things we merely
hope don't happen. also, always check for errors. ok deraadt
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r--sys/kern/exec_script.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index eda79906c99..f2f788fc4c7 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_script.c,v 1.32 2014/11/18 05:23:14 tedu Exp $ */
+/* $OpenBSD: exec_script.c,v 1.33 2014/11/19 21:19:15 tedu Exp $ */
/* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */
/*
@@ -205,7 +205,6 @@ check_shell:
}
*tmpsap = malloc(MAXPATHLEN, M_EXEC, M_WAITOK);
if ((epp->ep_flags & EXEC_HASFD) == 0) {
- /* normally can't fail, but check for it if diagnostic */
#if NSYSTRACE > 0
if (ISSET(p->p_flag, P_SYSTRACE)) {
error = systrace_scriptname(p, *tmpsap);
@@ -223,10 +222,8 @@ check_shell:
#endif
error = copyinstr(epp->ep_name, *tmpsap++, MAXPATHLEN,
NULL);
-#ifdef DIAGNOSTIC
if (error != 0)
- panic("exec_script: copyinstr couldn't fail");
-#endif
+ goto fail;
} else
snprintf(*tmpsap++, MAXPATHLEN, "/dev/fd/%d", epp->ep_fd);
*tmpsap = NULL;