diff options
-rw-r--r-- | src/backend/access/transam/xlog.c | 25 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 16 | ||||
-rw-r--r-- | src/include/port.h | 3 | ||||
-rw-r--r-- | src/port/path.c | 19 |
4 files changed, 44 insertions, 19 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 32ade5d7590..3c23f0fc292 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.159 2004/08/11 04:07:15 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.160 2004/08/12 18:32:25 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1962,17 +1962,20 @@ RestoreArchivedFile(char *path, const char *xlogfname, /* %p: full path of target file */ sp++; StrNCpy(dp, xlogpath, endp-dp); -#ifndef WIN32 + /* + * make_native_path() is required because COPY is an internal + * CMD.EXE command and doesn't process forward slashes in the + * same way as external commands. Quoting the first argument + * to COPY does not convert forward to backward slashes, but + * COPY does properly process quoted forward slashes in the + * second argument. + * + * COPY works with quoted forward slashes in the first argument + * only if the current directory is the same as the directory + * of the first argument. + */ + make_native_path(dp); dp += strlen(dp); -#else - /* On Windows, change / to \ in the substituted path */ - while (*dp) - { - if (*dp == '/') - *dp = '\\'; - dp++; - } -#endif break; case 'f': /* %f: filename of desired file */ diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 09ccdb2fb82..28463c6ae9b 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -117,13 +117,17 @@ # - Archiving - #archive_command = '' # command to use to archive a logfile segment - +# # If archive_command is '' then archiving is disabled. Otherwise, set it -# to a command to copy a file to the proper place. A simplistic example -# is 'cp %p /mnt/server/archivedir/%f'. Any %p in the string is replaced -# by the absolute path of the file to archive, while any %f is replaced by -# the file name only. NOTE: it is important for the command to return -# zero exit status if and only if it succeeded. +# to a command to copy a file to the proper place. Any %p in the string +# is replaced by the absolute path of the file to archive, while any %f is +# replaced by the file name only. NOTE: it is important for the command to +# return zero exit status only if it succeeds. +# +# Examples: +# archive_command = 'cp "%p" /mnt/server/archivedir/"%f"' +# archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Win32 + #--------------------------------------------------------------------------- # QUERY TUNING diff --git a/src/include/port.h b/src/include/port.h index 013243cc279..2091b8ec349 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.51 2004/08/09 02:12:51 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.52 2004/08/12 18:32:43 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,6 +39,7 @@ extern char *last_dir_separator(const char *filename); extern char *first_path_separator(const char *filename); extern void canonicalize_path(char *path); +extern void make_native_path(char *path); extern const char *get_progname(const char *argv0); extern void get_share_path(const char *my_exec_path, char *ret_path); extern void get_etc_path(const char *my_exec_path, char *ret_path); diff --git a/src/port/path.c b/src/port/path.c index 040c8a6eb72..2a7428d0ba6 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.27 2004/08/09 20:20:46 tgl Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.28 2004/08/12 18:32:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -88,6 +88,23 @@ last_dir_separator(const char *filename) /* + * make_native_path + * On WIN32, change / to \ in the path. + */ +void +make_native_path(char *filename) +{ +#ifdef WIN32 + char *p; + + for (p = filename; *p; p++) + if (*p == '/') + *p = '\\'; +#endif +} + + +/* * Make all paths look like Unix */ void |