diff -urN ccache-3.3.2.orig/ccache.h ccache-3.3.2/ccache.h --- ccache-3.3.2.orig/ccache.h 2016-09-29 04:44:46.000000000 +0800 +++ ccache-3.3.2/ccache.h 2016-10-23 19:01:12.582863400 +0800 @@ -258,7 +258,7 @@ #endif // mkstemp() on some versions of cygwin don't handle binary files, so override. -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) && !defined(__MSYS__) #undef HAVE_MKSTEMP #endif diff -urN ccache-3.3.2.orig/lockfile.c ccache-3.3.2/lockfile.c --- ccache-3.3.2.orig/lockfile.c 2016-09-29 04:44:46.000000000 +0800 +++ ccache-3.3.2/lockfile.c 2016-10-23 19:01:26.574809400 +0800 @@ -40,7 +40,7 @@ free(my_content); my_content = format("%s:%d:%d", hostname, (int)getpid(), (int)time(NULL)); -#ifdef _WIN32 +#if defined(_WIN32) || defined(__MSYS__) int fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL|O_BINARY, 0666); if (fd == -1) { int saved_errno = errno;