Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern ts2timo(): if TIMER_ABSTIME is set and start is not...
details: https://anonhg.NetBSD.org/src/rev/87ffe71c157e
branches: trunk
changeset: 786924:87ffe71c157e
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue May 21 16:25:55 2013 +0000
description:
ts2timo(): if TIMER_ABSTIME is set and start is not NULL, initialize
it to 0. Some callers (e.g. nanosleep1()) expect *start to always be
initialized and would use random values from stack otherwise.
While there, remove an always-true conditionnal.
diffstat:
sys/kern/subr_time.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diffs (38 lines):
diff -r 4d73d273c940 -r 87ffe71c157e sys/kern/subr_time.c
--- a/sys/kern/subr_time.c Tue May 21 15:57:21 2013 +0000
+++ b/sys/kern/subr_time.c Tue May 21 16:25:55 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_time.c,v 1.15 2013/04/01 16:37:22 christos Exp $ */
+/* $NetBSD: subr_time.c,v 1.16 2013/05/21 16:25:55 bouyer Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.15 2013/04/01 16:37:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.16 2013/05/21 16:25:55 bouyer Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -246,14 +246,15 @@
int error;
struct timespec tsd;
+ if (flags && start != NULL)
+ memset(start, 0, sizeof(*start));
+
flags &= TIMER_ABSTIME;
-
if (start == NULL || flags)
start = &tsd;
- if (start)
- if ((error = clock_gettime1(clock_id, start)) != 0)
- return error;
+ if ((error = clock_gettime1(clock_id, start)) != 0)
+ return error;
if (flags)
timespecsub(ts, start, ts);
Home |
Main Index |
Thread Index |
Old Index