Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Simplify error path and fix typos. From Maxime Vill...



details:   https://anonhg.NetBSD.org/src/rev/cef07b2a05da
branches:  trunk
changeset: 325694:cef07b2a05da
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 03 15:49:49 2014 +0000

description:
Simplify error path and fix typos. From Maxime Villard and me.

diffstat:

 sys/kern/kern_exec.c |  22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diffs (60 lines):

diff -r d8c329f1fd28 -r cef07b2a05da sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Fri Jan 03 15:15:02 2014 +0000
+++ b/sys/kern/kern_exec.c      Fri Jan 03 15:49:49 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.368 2013/12/24 14:47:04 christos Exp $ */
+/*     $NetBSD: kern_exec.c,v 1.369 2014/01/03 15:49:49 christos Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.368 2013/12/24 14:47:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.369 2014/01/03 15:49:49 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1823,11 +1823,11 @@
  * A child lwp of a posix_spawn operation starts here and ends up in
  * cpu_spawn_return, dealing with all filedescriptor and scheduler
  * manipulations in between.
- * The parent waits for the child, as it is not clear wether the child
- * will be able to aquire its own exec_lock. If it can, the parent can
+ * The parent waits for the child, as it is not clear whether the child
+ * will be able to acquire its own exec_lock. If it can, the parent can
  * be released early and continue running in parallel. If not (or if the
  * magic debug flag is passed in the scheduler attribute struct), the
- * child rides on the parent's exec lock untill it is ready to return to
+ * child rides on the parent's exec lock until it is ready to return to
  * to userland - and only then releases the parent. This method loses
  * concurrency, but improves error reporting.
  */
@@ -2001,7 +2001,7 @@
        /* release our refcount on the data */
        spawn_exec_data_release(spawn_data);
 
-       /* and finaly: leave to userland for the first time */
+       /* and finally: leave to userland for the first time */
        cpu_spawn_return(l);
 
        /* NOTREACHED */
@@ -2071,15 +2071,9 @@
 
        fa = kmem_alloc(sizeof(*fa), KM_SLEEP);
        error = copyin(ufa, fa, sizeof(*fa));
-       if (error) {
-               fa->fae = NULL;
-               fa->len = 0;
-               goto out;
-       }
-
-       if (fa->len == 0) {
+       if (error || fa->len == 0) {
                kmem_free(fa, sizeof(*fa));
-               return 0;
+               return error;   /* 0 if not an error, and len == 0 */
        }
 
        fa->size = fa->len;



Home | Main Index | Thread Index | Old Index