Index: block_to_imp.c
===================================================================
--- block_to_imp.c	(revision 36982)
+++ block_to_imp.c	(working copy)
@@ -16,7 +16,34 @@
 #include "lock.h"
 #include "visibility.h"
 
+#ifdef __MINGW32__
+#include <stdarg.h>
 
+# define mkstemp(p) _open(_mktemp(p), _O_CREAT | _O_SHORT_LIVED | _O_EXCL) 
+
+int asprintf( char **, char *, ... );
+int vasprintf( char **, char *, va_list );
+
+int vasprintf( char **sptr, char *fmt, va_list argv )
+{
+  int wanted = vsnprintf( *sptr = NULL, 0, fmt, argv );
+  if( (wanted < 0) || ((*sptr = malloc( 1 + wanted )) == NULL) )
+  return -1;
+
+  return vsprintf( *sptr, fmt, argv );
+}
+
+int asprintf( char **sptr, char *fmt, ... )
+{
+  int retval;
+  va_list argv;
+  va_start( argv, fmt );
+  retval = vasprintf( sptr, fmt, argv );
+  va_end( argv );
+  return retval;
+}
+#endif
+
 /* QNX needs a special header for asprintf() */
 #ifdef __QNXNTO__
 #include <nbutil.h>
