summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdtime
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-03-24 01:35:37 +0000
committerdim <dim@FreeBSD.org>2013-03-24 01:35:37 +0000
commite6c84f6819d7e05d9645f140d5004b875d11acbd (patch)
tree1bfaff692ece3a59ea939fe9eb07943c29fb8be8 /lib/libc/stdtime
parent0b04a7a29ef792fb8041bce759892be5b96e1905 (diff)
downloadFreeBSD-src-e6c84f6819d7e05d9645f140d5004b875d11acbd.zip
FreeBSD-src-e6c84f6819d7e05d9645f140d5004b875d11acbd.tar.gz
Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
on signed integer overflow wrapping. Otherwise mktime(3) and timegm(3) can hang, in case the timestamp passed in struct tm is not representable in a time_t. Specifically, any timestamp after 2038-01-19 03:14:07, in combination with a 32-bit time_t. Note that it would be better to change the code to not rely on undefined behaviour, but it is contributed code, and it is not entirely trivial to fix the issue properly. MFC after: 3 days
Diffstat (limited to 'lib/libc/stdtime')
-rw-r--r--lib/libc/stdtime/Makefile.inc3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc
index 0cc038a..477049f 100644
--- a/lib/libc/stdtime/Makefile.inc
+++ b/lib/libc/stdtime/Makefile.inc
@@ -11,6 +11,9 @@ SYM_MAPS+= ${.CURDIR}/stdtime/Symbol.map
CFLAGS+= -I${.CURDIR}/../../contrib/tzcode/stdtime -I${.CURDIR}/stdtime
+CFLAGS.localtime.c= -fwrapv
+CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
+
MAN+= ctime.3 strftime.3 strptime.3 time2posix.3
MAN+= tzfile.5
OpenPOWER on IntegriCloud