strptime() on OpenBSD requires _XOPEN_SOURCE_EXTENDED 1 (fix #999)

strptime() is an XPG4v2 function, on OpenBSD the prototype
is not included in time.h unless visibility is set, it needs
either "#define _XOPEN_SOURCE_EXTENDED 1" or _XOPEN_SOURCE
>= 500. Without this the prototype isn't included and
strptime's returned pointer is truncated to an int, causing
SEGV on 64-bit arches when using it.

Thanks @sthen
This commit is contained in:
David Tolnay committed 2015-10-24 11:23:56 -07:00
1 parent b7a219a91d
commit 2f79004f85
1 file changed
+1
+1
View File
@@ -1,6 +1,7 @@
#define _BSD_SOURCE
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED 1
#include <sys/time.h>
#include <stdlib.h>
#include <stddef.h>