|
1 | 1 | /*
|
2 |
| - * $PostgreSQL: pgsql/contrib/pg_archivecleanup/pg_archivecleanup.c,v 1.3 2010/07/06 19:18:55 momjian Exp $ |
| 2 | + * $PostgreSQL: pgsql/contrib/pg_archivecleanup/pg_archivecleanup.c,v 1.4 2010/08/23 02:56:24 tgl Exp $ |
3 | 3 | *
|
4 | 4 | * pg_archivecleanup.c
|
5 | 5 | *
|
|
18 | 18 | #include<fcntl.h>
|
19 | 19 | #include<signal.h>
|
20 | 20 |
|
21 |
| -#ifdefWIN32 |
22 |
| -intgetopt(intargc,char*constargv[],constchar*optstring); |
23 |
| -#else |
| 21 | +#ifndefWIN32 |
24 | 22 | #include<sys/time.h>
|
25 | 23 | #include<unistd.h>
|
26 | 24 |
|
27 | 25 | #ifdefHAVE_GETOPT_H
|
28 | 26 | #include<getopt.h>
|
29 | 27 | #endif
|
30 |
| -#endif/* ! WIN32 */ |
| 28 | +#else/* WIN32 */ |
| 29 | +externintgetopt(intargc,char*constargv[],constchar*optstring); |
| 30 | +#endif/* ! WIN32 */ |
31 | 31 |
|
32 | 32 | externchar*optarg;
|
33 | 33 | externintoptind;
|
@@ -117,12 +117,8 @@ CleanupPriorWALFiles(void)
|
117 | 117 | strspn(xlde->d_name,"0123456789ABCDEF")==XLOG_DATA_FNAME_LEN&&
|
118 | 118 | strcmp(xlde->d_name+8,exclusiveCleanupFileName+8)<0)
|
119 | 119 | {
|
120 |
| -#ifdefWIN32 |
121 |
| -snprintf(WALFilePath,MAXPGPATH,"%s\\%s",archiveLocation,xlde->d_name); |
122 |
| -#else |
123 |
| -snprintf(WALFilePath,MAXPGPATH,"%s/%s",archiveLocation,xlde->d_name); |
124 |
| -#endif |
125 |
| - |
| 120 | +snprintf(WALFilePath,MAXPGPATH,"%s/%s", |
| 121 | +archiveLocation,xlde->d_name); |
126 | 122 | if (debug)
|
127 | 123 | fprintf(stderr,"%s: removing file \"%s\"\n",
|
128 | 124 | progname,WALFilePath);
|
@@ -308,8 +304,12 @@ main(int argc, char **argv)
|
308 | 304 | SetWALFileNameForCleanup();
|
309 | 305 |
|
310 | 306 | if (debug)
|
| 307 | +{ |
| 308 | +snprintf(WALFilePath,MAXPGPATH,"%s/%s", |
| 309 | +archiveLocation,exclusiveCleanupFileName); |
311 | 310 | fprintf(stderr,"%s: keep WAL file \"%s\" and later\n",
|
312 |
| -progname,exclusiveCleanupFileName); |
| 311 | +progname,WALFilePath); |
| 312 | +} |
313 | 313 |
|
314 | 314 | /*
|
315 | 315 | * Remove WAL files older than cut-off
|
|