Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0083280

Browse files
committed
A quick try at un-breaking the Cygwin build. Whether it needs the
pgwin32_safestat remains to be determined, but in any case the currentcode is not tolerable.
1 parent65c3d05 commit0083280

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

‎src/include/port.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.119 2008/04/10 16:58:51 mha Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.120 2008/04/11 23:53:00 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -281,9 +281,23 @@ extern void copydir(char *fromdir, char *todir, bool recurse);
281281

282282
externboolrmtree(char*path,boolrmtopdir);
283283

284+
/*
285+
* stat() is not guaranteed to set the st_size field on win32, so we
286+
* redefine it to our own implementation that is.
287+
*
288+
* We must pull in sys/stat.h here so the system header definition
289+
* goes in first, and we redefine that, and not the other way around.
290+
*/
291+
#if defined(WIN32)&& !defined(__CYGWIN__)
292+
#include<sys/stat.h>
293+
externintpgwin32_safestat(constchar*path,structstat*buf);
294+
#definestat(a,b) pgwin32_safestat(a,b)
295+
#endif
296+
284297
#if defined(WIN32)&& !defined(__CYGWIN__)
285298

286-
/* open() and fopen() replacements to allow deletion of open files and
299+
/*
300+
* open() and fopen() replacements to allow deletion of open files and
287301
* passing of other special options.
288302
*/
289303
#defineO_DIRECT0x80000000
@@ -298,19 +312,6 @@ extern FILE *pgwin32_fopen(const char *, const char *);
298312
#definepopen(a,b) _popen(a,b)
299313
#definepclose(a) _pclose(a)
300314

301-
/*
302-
* stat() is not guaranteed to set the st_size field on win32, so we
303-
* redefine it to our own implementation that is.
304-
*
305-
* We must pull in sys/stat.h here so the system header definition
306-
* goes in first, and we redefine that, and not the other way around.
307-
*/
308-
externintpgwin32_safestat(constchar*path,structstat*buf);
309-
#if !defined(FRONTEND)&& !defined(_DIRMOD_C)
310-
#include<sys/stat.h>
311-
#definestat(a,b) pgwin32_safestat(a,b)
312-
#endif
313-
314315
/* Missing rand functions */
315316
externlonglrand48(void);
316317
externvoidsrand48(longseed);

‎src/port/dirmod.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*Win32 (NT, Win2k, XP).replace() doesn't work on Win95/98/Me.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.52 2008/04/10 16:58:51 mha Exp $
13+
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.53 2008/04/11 23:53:00 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -449,13 +449,15 @@ rmtree(char *path, bool rmtopdir)
449449
}
450450

451451

452-
#ifdefWIN32
452+
#if defined(WIN32)&& !defined(__CYGWIN__)
453+
454+
#undef stat
455+
453456
/*
454457
* The stat() function in win32 is not guaranteed to update the st_size
455458
* field when run. So we define our own version that uses the Win32 API
456459
* to update this field.
457460
*/
458-
#undef stat
459461
int
460462
pgwin32_safestat(constchar*path,structstat*buf)
461463
{
@@ -480,4 +482,5 @@ pgwin32_safestat(const char *path, struct stat *buf)
480482

481483
return0;
482484
}
485+
483486
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp