1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

For application to HEAD, following community review.

* Changes incorrect CYGWIN defines to __CYGWIN__

* Some localtime returns NULL checks (when unchecked cause SEGVs under
Win32
regression tests)

* Rationalized CreateSharedMemoryAndSemaphores and
AttachSharedMemoryAndSemaphores (Bruce, I finally remembered to do it);
requires attention.

Claudio Natoli
This commit is contained in:
Bruce Momjian
2004-02-25 19:41:23 +00:00
parent 5ada9ef088
commit c672aa823b
11 changed files with 102 additions and 104 deletions

View File

@ -10,20 +10,25 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.10 2004/02/02 22:20:33 momjian Exp $
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.11 2004/02/25 19:41:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TEST_VERSION
#if defined(WIN32) || defined(CYGWIN)
#if defined(WIN32) || defined(__CYGWIN__)
#ifdef __CYGWIN__
#include <sys/time.h> /* timeval definition for PG_USLEEP */
#endif
#ifndef FRONTEND
#include "postgres.h"
#else
#include "postgres_fe.h"
#endif
#include "miscadmin.h"
#undef rename
#undef unlink
@ -36,19 +41,19 @@ pgrename(const char *from, const char *to)
#ifdef WIN32
while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
#endif
#ifdef CYGWIN
#ifdef __CYGWIN__
while (rename(from, to) < 0)
#endif
{
#ifdef WIN32
if (GetLastError() != ERROR_ACCESS_DENIED)
#endif
#ifdef CYGWIN
#ifdef __CYGWIN__
if (errno != EACCES)
#endif
/* set errno? */
return -1;
Sleep(100); /* ms */
PG_USLEEP(100000); /* us */
if (loops == 30)
#ifndef FRONTEND
elog(LOG, "could not rename \"%s\" to \"%s\", continuing to try",
@ -80,7 +85,7 @@ pgunlink(const char *path)
if (errno != EACCES)
/* set errno? */
return -1;
Sleep(100); /* ms */
PG_USLEEP(100000); /* us */
if (loops == 30)
#ifndef FRONTEND
elog(LOG, "could not unlink \"%s\", continuing to try",