Don't trust CreateFileMapping() to clear the error code on success.
Don't trust CreateFileMapping() to clear the error code on success.

We must test GetLastError() even when CreateFileMapping() returns a
non-null handle.  If that value were left over from some previous system
call, we might be fooled into thinking the segment already existed.
Experimentation on Windows 7 suggests that CreateFileMapping() clears
the error code on success, but it is not documented to do so, so let's
not rely on that happening in all Windows releases.

Amit Kapila

Discussion: <61dc4d829b2cb07d47198a8cf07240ba2d6dc068@sss.pgh.pa.us>

greenplum-db/gpdb,ashwinstar/gpdb,50wu/gpdb,50wu/gpdb,lisakowen/gpdb,adam8157/gpdb,ashwinstar/gpdb,adam8157/gpdb,adam8157/gpdb,ashwinstar/gpdb,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,50wu/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,adam8157/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,lisakowen/gpdb,jmcatamney/gpdb,lisakowen/gpdb,50wu/gpdb,jmcatamney/gpdb,xinzweb/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,lisakowen/gpdb,greenplum-db/gpdb,xinzweb/gpdb,jmcatamney/gpdb,xinzweb/gpdb,xinzweb/gpdb,xinzweb/gpdb,jmcatamney/gpdb,50wu/gpdb,50wu/gpdb,lisakowen/gpdb,xinzweb/gpdb,greenplum-db/gpdb,50wu/gpdb,ashwinstar/gpdb,lisakowen/gpdb,xinzweb/gpdb,greenplum-db/gpdb,adam8157/gpdb,lisakowen/gpdb,50wu/gpdb,adam8157/gpdb,adam8157/gpdb,greenplum-db/gpdb,xinzweb/gpdb,jmcatamney/gpdb