diff --git a/changes/bug7260 b/changes/bug7260 new file mode 100644 index 0000000000000000000000000000000000000000..f174461400b44ae6da99ec18ac722589678eb305 --- /dev/null +++ b/changes/bug7260 @@ -0,0 +1,2 @@ + o Minor bugfixes: + - Compile on win64 using mingw64. Fixes bug 7260; patches from "yayooo". diff --git a/configure.ac b/configure.ac index 105528e1422f59372dd62c36f7f611da11894b72..9cc19f897a62dea4d1ba41af3bdc98a3fffa3b01 100644 --- a/configure.ac +++ b/configure.ac @@ -318,6 +318,7 @@ AC_CHECK_FUNCS( sysconf \ uname \ vasprintf \ + _vscprintf ) if test "$enable_threads" = "yes"; then @@ -784,6 +785,7 @@ AC_CHECK_SIZEOF(__int64) AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(time_t) AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(pid_t) AC_CHECK_TYPES([uint, u_char, ssize_t]) diff --git a/src/common/compat.c b/src/common/compat.c index b8674a2f5f450d8c75b3ea20aede3b9db069df0b..74585cd614fb52ac31f0397f06ca31b3b2233761 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -425,7 +425,7 @@ tor_vasprintf(char **strp, const char *fmt, va_list args) else *strp = strp_tmp; return r; -#elif defined(_MSC_VER) +#elif defined(HAVE__VSCPRINTF) /* On Windows, _vsnprintf won't tell us the length of the string if it * overflows, so we need to use _vcsprintf to tell how much to allocate */ int len, r; diff --git a/src/common/procmon.c b/src/common/procmon.c index 36b1a48553630d27b51099ee68560f91ac494dee..3f92c16ee389946b2610015f0620f1527b0c71d4 100644 --- a/src/common/procmon.c +++ b/src/common/procmon.c @@ -25,7 +25,9 @@ #ifdef _WIN32 #include <windows.h> +#endif +#if 0 == SIZEOF_PID_T /* Windows does not define pid_t, but _getpid() returns an int. */ typedef int pid_t; #endif diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h index e4b2df78a97ee5b83337f3f20e8dae8fdea50e14..4055bb07abaf4a813a853904cf9afbbaec5750d2 100644 --- a/src/win32/orconfig.h +++ b/src/win32/orconfig.h @@ -145,6 +145,9 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `_vscprintf' function. */ +#define HAVE__VSCPRINTF 1 + /* Define to 1 iff NULL is represented by a 0 in memory. */ #define NULL_REP_IS_ZERO_BYTES 1 @@ -190,6 +193,9 @@ /* The size of a `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG +/* The size of `pid_t', as computed by sizeof. */ +#define SIZEOF_PID_T 0 + /* The size of a `short', as computed by sizeof. */ #define SIZEOF_SHORT 2