|
|
|
@ -1,7 +1,6 @@ |
|
|
|
|
/*
|
|
|
|
|
* These are replacement versions of unlink and rename that work on |
|
|
|
|
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#ifndef TEST_VERSION |
|
|
|
@ -11,7 +10,8 @@ |
|
|
|
|
#undef rename |
|
|
|
|
#undef unlink |
|
|
|
|
|
|
|
|
|
int pgrename(const char *from, const char *to) |
|
|
|
|
int |
|
|
|
|
pgrename(const char *from, const char *to) |
|
|
|
|
{ |
|
|
|
|
int loops = 0; |
|
|
|
|
|
|
|
|
@ -23,24 +23,27 @@ int pgrename(const char *from, const char *to) |
|
|
|
|
Sleep(100); /* ms */ |
|
|
|
|
if (loops == 10) |
|
|
|
|
#ifndef FRONTEND |
|
|
|
|
elog(LOG, "Unable to rename %s to %s, continuing to try", from, to); |
|
|
|
|
elog(LOG, "could not rename \"%s\" to \"%s\", continuing to try", |
|
|
|
|
from, to); |
|
|
|
|
#else |
|
|
|
|
fprintf(stderr, "Unable to rename %s to %s, continuing to try\n", from, to); |
|
|
|
|
fprintf(stderr, "could not rename \"%s\" to \"%s\", continuing to try\n", |
|
|
|
|
from, to); |
|
|
|
|
#endif |
|
|
|
|
loops++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (loops > 10) |
|
|
|
|
#ifndef FRONTEND |
|
|
|
|
elog(LOG, "Completed rename of %s to %s", from, to); |
|
|
|
|
elog(LOG, "completed rename of \"%s\" to \"%s\"", from, to); |
|
|
|
|
#else |
|
|
|
|
fprintf(stderr, "Completed rename of %s to %s\n", from, to); |
|
|
|
|
fprintf(stderr, "completed rename of \"%s\" to \"%s\"\n", from, to); |
|
|
|
|
#endif |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int pgunlink(const char *path) |
|
|
|
|
int |
|
|
|
|
pgunlink(const char *path) |
|
|
|
|
{ |
|
|
|
|
int loops = 0; |
|
|
|
|
|
|
|
|
@ -52,18 +55,20 @@ int pgunlink(const char *path) |
|
|
|
|
Sleep(100); /* ms */ |
|
|
|
|
if (loops == 10) |
|
|
|
|
#ifndef FRONTEND |
|
|
|
|
elog(LOG, "Unable to unlink %s, continuing to try", path); |
|
|
|
|
elog(LOG, "could not unlink \"%s\", continuing to try", |
|
|
|
|
path); |
|
|
|
|
#else |
|
|
|
|
fprintf(stderr, "Unable to unlink %s, continuing to try\n", path); |
|
|
|
|
fprintf(stderr, "could not unlink \"%s\", continuing to try\n", |
|
|
|
|
path); |
|
|
|
|
#endif |
|
|
|
|
loops++; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (loops > 10) |
|
|
|
|
#ifndef FRONTEND |
|
|
|
|
elog(LOG, "Completed unlink of %s", path); |
|
|
|
|
elog(LOG, "completed unlink of \"%s\"", path); |
|
|
|
|
#else |
|
|
|
|
fprintf(stderr, "Completed unlink of %s\n", path); |
|
|
|
|
fprintf(stderr, "completed unlink of \"%s\"\n", path); |
|
|
|
|
#endif |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -143,4 +148,5 @@ main(int argc, char* argv[]) |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|