diff --git a/src/port/open.c b/src/port/open.c
index b9dc8d0d205b481374d19da4ee2efd68c94254bb..8ecddbbf9eb7898abb51bd81ddbd322afbaec1e4 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -6,7 +6,7 @@
  *
  * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/port/open.c,v 1.28 2009/06/11 14:49:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/open.c,v 1.29 2010/01/02 12:00:08 mha Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ pgwin32_open(const char *fileName, int fileFlags,...)
 	}
 
 	/* _open_osfhandle will, on error, set errno accordingly */
-	if ((fd = _open_osfhandle((long) h, fileFlags & O_APPEND)) < 0)
+	if ((fd = _open_osfhandle((intptr_t) h, fileFlags & O_APPEND)) < 0)
 		CloseHandle(h);			/* will not affect errno */
 	else if (fileFlags & (O_TEXT | O_BINARY) &&
 			 _setmode(fd, fileFlags & (O_TEXT | O_BINARY)) < 0)