Skip to content

Commit 9d15292

Browse files
committed
pg_upgrade: use single or double-quotes in command-line strings
This is platform-dependent.
1 parent 2078176 commit 9d15292

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,8 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
532532
#endif
533533

534534
/* delete old cluster's default tablespace */
535-
fprintf(script, RMDIR_CMD " \"%s\"\n", fix_path_separator(old_cluster.pgdata));
535+
fprintf(script, RMDIR_CMD " %c%s%c\n", PATH_QUOTE,
536+
fix_path_separator(old_cluster.pgdata), PATH_QUOTE);
536537

537538
/* delete old cluster's alternate tablespaces */
538539
for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++)
@@ -554,9 +555,10 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
554555
PATH_SEPARATOR);
555556

556557
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
557-
fprintf(script, RMDIR_CMD " \"%s%c%d\"\n",
558+
fprintf(script, RMDIR_CMD " %c%s%c%d%c\n", PATH_QUOTE,
558559
fix_path_separator(os_info.old_tablespaces[tblnum]),
559-
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
560+
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid,
561+
PATH_QUOTE);
560562
}
561563
else
562564
{
@@ -566,9 +568,9 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
566568
* Simply delete the tablespace directory, which might be ".old"
567569
* or a version-specific subdirectory.
568570
*/
569-
fprintf(script, RMDIR_CMD " \"%s%s\"\n",
571+
fprintf(script, RMDIR_CMD " %c%s%s%c\n", PATH_QUOTE,
570572
fix_path_separator(os_info.old_tablespaces[tblnum]),
571-
fix_path_separator(suffix_path));
573+
fix_path_separator(suffix_path), PATH_QUOTE);
572574
pfree(suffix_path);
573575
}
574576
}

src/bin/pg_upgrade/pg_upgrade.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extern char *output_files[];
7474
#define pg_mv_file rename
7575
#define pg_link_file link
7676
#define PATH_SEPARATOR '/'
77+
#define PATH_QUOTE '\''
7778
#define RM_CMD "rm -f"
7879
#define RMDIR_CMD "rm -rf"
7980
#define SCRIPT_PREFIX "./"
@@ -85,6 +86,7 @@ extern char *output_files[];
8586
#define pg_mv_file pgrename
8687
#define pg_link_file win32_pghardlink
8788
#define PATH_SEPARATOR '\\'
89+
#define PATH_QUOTE '"'
8890
#define RM_CMD "DEL /q"
8991
#define RMDIR_CMD "RMDIR /s/q"
9092
#define SCRIPT_PREFIX ""

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