Skip to content

Commit 3e4fbdb

Browse files
hilluplusvic
authored andcommitted
Do not depend on mkgmtime being available on Win32 (#747)
This fixes (cross-)building with OpenSSL support for MinGW.
1 parent 190bfec commit 3e4fbdb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ACX_PTHREAD(
4646

4747
AC_CHECK_LIB(m, isnan)
4848
AC_CHECK_LIB(m, log2)
49-
AC_CHECK_FUNCS([strlcpy strlcat memmem timegm])
49+
AC_CHECK_FUNCS([strlcpy strlcat memmem timegm _mkgmtime])
5050

5151
AC_ARG_ENABLE([debug],
5252
[AS_HELP_STRING([--enable-debug], [compiles with -g option])],

libyara/modules/pe_utils.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

3030
#include <stdio.h>
3131

32-
#if defined(_WIN32)
33-
#define timegm _mkgmtime
34-
#endif
35-
3632
#include <string.h>
3733

3834
#include <yara/endian.h>
@@ -219,7 +215,10 @@ int64_t pe_rva_to_offset(
219215
}
220216

221217

222-
#if !HAVE_TIMEGM && !defined(WIN32)
218+
#if !HAVE_TIMEGM
219+
#if HAVE__MKGMTIME
220+
#define timegm _mkgmtime
221+
#else
223222

224223
#include <time.h>
225224

@@ -258,7 +257,8 @@ time_t timegm(
258257
return res;
259258
}
260259

261-
#endif
260+
#endif // HAVE__MKGMTIME
261+
#endif // !HAVE_TIMEGM
262262

263263
#if HAVE_LIBCRYPTO
264264

0 commit comments

Comments
 (0)