Apply fix from natuve clock_nanosleep(2) to not copyout remaining time

struct if TIMER_ABSTIME flag is set.
This commit is contained in:
njoly 2017-02-26 10:26:19 +00:00
parent b9dbf5bad7
commit bf758697bc
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_time.c,v 1.48 2016/09/23 14:16:32 skrll Exp $ */
/* $NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.48 2016/09/23 14:16:32 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.49 2017/02/26 10:26:19 njoly Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@ -453,7 +453,8 @@ netbsd32_clock_nanosleep(struct lwp *l, const struct netbsd32_clock_nanosleep_ar
goto out;
netbsd32_from_timespec(&rmt, &ts32);
if ((error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32))) != 0)
if ((SCARG(uap, flags) & TIMER_ABSTIME) == 0 &&
(error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32))) != 0)
error = error1;
out:
*retval = error;