Skip to content

Commit 35f539b

Browse files
committed
When expanding %p in archive_command or restore_command, translate
slashes to backslashes #ifdef WIN32. This is to cope with the fact that Windows seems exceedingly unfriendly to slashes in shell commands, as per recent discussion.
1 parent 1109959 commit 35f539b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.157 2004/08/08 03:22:08 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.158 2004/08/09 16:26:01 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1962,7 +1962,17 @@ RestoreArchivedFile(char *path, const char *xlogfname,
19621962
/* %p: full path of target file */
19631963
sp++;
19641964
StrNCpy(dp, xlogpath, endp-dp);
1965+
#ifndef WIN32
19651966
dp += strlen(dp);
1967+
#else
1968+
/* On Windows, change / to \ in the substituted path */
1969+
while (*dp)
1970+
{
1971+
if (*dp == '/')
1972+
*dp = '\\';
1973+
dp++;
1974+
}
1975+
#endif
19661976
break;
19671977
case 'f':
19681978
/* %f: filename of desired file */

src/backend/postmaster/pgarch.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*
2121
* IDENTIFICATION
22-
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.5 2004/08/05 23:32:10 tgl Exp $
22+
* $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.6 2004/08/09 16:26:06 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -436,7 +436,17 @@ pgarch_archiveXlog(char *xlog)
436436
/* %p: full path of source file */
437437
sp++;
438438
StrNCpy(dp, pathname, endp-dp);
439+
#ifndef WIN32
439440
dp += strlen(dp);
441+
#else
442+
/* On Windows, change / to \ in the substituted path */
443+
while (*dp)
444+
{
445+
if (*dp == '/')
446+
*dp = '\\';
447+
dp++;
448+
}
449+
#endif
440450
break;
441451
case 'f':
442452
/* %f: filename of source file */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy