diff --git a/cmake/PlatformDefaults.cmake b/cmake/PlatformDefaults.cmake index 3dc673fa0..01050c8df 100644 --- a/cmake/PlatformDefaults.cmake +++ b/cmake/PlatformDefaults.cmake @@ -4,17 +4,17 @@ if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES add_definitions("-D_UWP") set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "platform default") endif() -# Enable 64bit file support on linux and FreeBSD. + if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") add_definitions("-D_FILE_OFFSET_BITS=64") + add_definitions("-DWINPR_TIMEZONE_FILE=\"/etc/timezone\"") endif() -if("${CMAKE_SYSTEM_NAME}" MATCHES FREEBSD) +if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD") add_definitions("-D_FILE_OFFSET_BITS=64") + add_definitions("-DWINPR_TIMEZONE_FILE=\"/var/db/zoneinfo\"") endif() -# Use Standard conforming getpwnam_r() on Solaris. -# Use Standard conforming getpwnam_r() on Solaris. if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS") add_definitions("-D_POSIX_PTHREAD_SEMANTICS") list(APPEND CMAKE_STANDARD_LIBRARIES rt) diff --git a/winpr/libwinpr/timezone/timezone.c b/winpr/libwinpr/timezone/timezone.c index f6d987499..6ca3e5443 100644 --- a/winpr/libwinpr/timezone/timezone.c +++ b/winpr/libwinpr/timezone/timezone.c @@ -247,10 +247,11 @@ static char* winpr_get_unix_timezone_identifier_from_file(void) #else FILE* fp = NULL; char* tzid = NULL; -#if defined(__FreeBSD__) || defined(__OpenBSD__) - fp = winpr_fopen("/var/db/zoneinfo", "r"); +#if !defined(WINPR_TIMEZONE_FILE) +#error \ + "Please define WINPR_TIMEZONE_FILE with the path to your timezone file (e.g. /etc/timezone or similar)" #else - fp = winpr_fopen("/etc/timezone", "r"); + fp = winpr_fopen(WINPR_TIMEZONE_FILE, "r"); #endif if (NULL == fp)