Source-Changes-HG archive

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

[src/netbsd-7-0]: src/sys/kern Pull up following revision(s) (requested by uw...



details:   https://anonhg.NetBSD.org/src/rev/c47f595cd2f5
branches:  netbsd-7-0
changeset: 801149:c47f595cd2f5
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 03 15:41:35 2016 +0000

description:
Pull up following revision(s) (requested by uwe in ticket #1128):
        sys/kern/kern_time.c: revision 1.184
Don't leak garabage from the kernel stack on sleep(0) and equivalents.
Hat tip to perl's ext/POSIX/t/wrappers.t

diffstat:

 sys/kern/kern_time.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 1ae2716997c4 -r c47f595cd2f5 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c      Thu Mar 03 14:46:07 2016 +0000
+++ b/sys/kern/kern_time.c      Thu Mar 03 15:41:35 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $ */
+/*     $NetBSD: kern_time.c,v 1.179.12.1 2016/03/03 15:41:35 martin Exp $      */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179 2013/05/22 16:00:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.179.12.1 2016/03/03 15:41:35 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/resourcevar.h>
@@ -328,8 +328,14 @@
        struct timespec rmtstart;
        int error, timo;
 
-       if ((error = ts2timo(clock_id, flags, rqt, &timo, &rmtstart)) != 0)
-               return error == ETIMEDOUT ? 0 : error;
+       if ((error = ts2timo(clock_id, flags, rqt, &timo, &rmtstart)) != 0) {
+               if (error == ETIMEDOUT) {
+                       error = 0;
+                       if (rmt != NULL)
+                               rmt->tv_sec = rmt->tv_nsec = 0;
+               }
+               return error;
+       }
 
        /*
         * Avoid inadvertently sleeping forever



Home | Main Index | Thread Index | Old Index