diff options
| author | 2013-05-10 10:31:16 +0000 | |
|---|---|---|
| committer | 2013-05-10 10:31:16 +0000 | |
| commit | 2c2f69ab178ebda4550e37c4fc2147f22dfc6ae0 (patch) | |
| tree | 77125e763f8c57e2b39f24e9c83786ea556844d2 /sys/compat/linux/linux_time.c | |
| parent | Flush the secondary cache when dumping. (diff) | |
| download | wireguard-openbsd-2c2f69ab178ebda4550e37c4fc2147f22dfc6ae0.tar.xz wireguard-openbsd-2c2f69ab178ebda4550e37c4fc2147f22dfc6ae0.zip | |
compat_linux: Add support for future time_t and ino_t size enlargements.
Reviewed by guenther@.
Diffstat (limited to 'sys/compat/linux/linux_time.c')
| -rw-r--r-- | sys/compat/linux/linux_time.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index bbc52c05624..5f66d7d3da8 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_time.c,v 1.3 2011/07/05 18:56:40 pirofti Exp $ */ +/* $OpenBSD: linux_time.c,v 1.4 2013/05/10 10:31:16 pirofti Exp $ */ /* * Copyright (c) 2010, 2011 Paul Irofti <pirofti@openbsd.org> * @@ -46,11 +46,14 @@ #define LINUX_CLOCK_REALTIME_HR 4 #define LINUX_CLOCK_MONOTONIC_HR 5 -void +int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) { + if (ntp->tv_sec > LINUX_TIME_MAX) + return EOVERFLOW; ltp->tv_sec = ntp->tv_sec; ltp->tv_nsec = ntp->tv_nsec; + return 0; } void @@ -122,7 +125,9 @@ linux_sys_clock_gettime(struct proc *p, void *v, register_t *retval) if (error != 0) return error; - native_to_linux_timespec(<p, &tp); + error = native_to_linux_timespec(<p, &tp); + if (error != 0) + return error; return (copyout(<p, SCARG(uap, tp), sizeof ltp)); } |
