Module Name:    src
Committed By:   maxv
Date:           Mon Jun 23 18:06:32 UTC 2014

Modified Files:
        src/sys/kern: exec_script.c

Log Message:
Use KASSERT() instead of #ifdef(DIAGNOSTIC). Clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/kern/exec_script.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/exec_script.c
diff -u src/sys/kern/exec_script.c:1.70 src/sys/kern/exec_script.c:1.71
--- src/sys/kern/exec_script.c:1.70	Fri Mar  7 01:34:29 2014
+++ src/sys/kern/exec_script.c	Mon Jun 23 18:06:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_script.c,v 1.70 2014/03/07 01:34:29 christos Exp $	*/
+/*	$NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.70 2014/03/07 01:34:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $");
 
 #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
 #define FDSCRIPTS		/* Need this for safe set-id scripts. */
@@ -222,10 +222,7 @@ check_shell:
 	    ) {
 		struct file *fp;
 
-#if defined(DIAGNOSTIC) && defined(FDSCRIPTS)
-		if (epp->ep_flags & EXEC_HASFD)
-			panic("exec_script_makecmds: epp already has a fd");
-#endif
+		KASSERT(!(epp->ep_flags & EXEC_HASFD));
 
 		if ((error = fd_allocfile(&fp, &epp->ep_fd)) != 0) {
 			scriptvp = NULL;
@@ -262,12 +259,9 @@ check_shell:
 #endif
 		/* normally can't fail, but check for it if diagnostic */
 		error = copystr(epp->ep_kname, tmpsap->fa_arg, MAXPATHLEN,
-		    (size_t *)0);
+		    NULL);
+		KASSERT(error == 0);
 		tmpsap++;
-#ifdef DIAGNOSTIC
-		if (error != 0)
-			panic("exec_script: copystr couldn't fail");
-#endif
 #ifdef FDSCRIPTS
 	} else {
 		snprintf(tmpsap->fa_arg, MAXPATHLEN, "/dev/fd/%d", epp->ep_fd);

Reply via email to