mirror of https://github.com/postgres/postgres
Use SYSTEMQUOTE as concatentation to strings, rather than %s printf
patterns, for clarity.
This commit is contained in:
parent
124c22d5fd
commit
a1183238be
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.559 2008/06/19 21:32:56 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.560 2008/06/26 01:35:45 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
|
@ -4184,7 +4184,7 @@ CreateOptsFile(int argc, char *argv[], char *fullprogname)
|
|||
|
||||
fprintf(fp, "%s", fullprogname);
|
||||
for (i = 1; i < argc; i++)
|
||||
fprintf(fp, " %s%s%s", SYSTEMQUOTE, argv[i], SYSTEMQUOTE);
|
||||
fprintf(fp, " " SYSTEMQUOTE "%s" SYSTEMQUOTE, argv[i]);
|
||||
fputs("\n", fp);
|
||||
|
||||
if (fclose(fp))
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
* Portions taken from FreeBSD.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.156 2008/06/02 03:48:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.157 2008/06/26 01:35:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -1078,14 +1078,14 @@ test_config_settings(void)
|
|||
test_max_fsm = FSM_FOR_BUFS(test_buffs);
|
||||
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"%s\"%s\" --boot -x0 %s "
|
||||
SYSTEMQUOTE "\"%s\" --boot -x0 %s "
|
||||
"-c max_connections=%d "
|
||||
"-c shared_buffers=%d "
|
||||
"-c max_fsm_pages=%d "
|
||||
"< \"%s\" > \"%s\" 2>&1%s",
|
||||
SYSTEMQUOTE, backend_exec, boot_options,
|
||||
"< \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
backend_exec, boot_options,
|
||||
test_conns, test_buffs, test_max_fsm,
|
||||
DEVNULL, DEVNULL, SYSTEMQUOTE);
|
||||
DEVNULL, DEVNULL);
|
||||
status = system(cmd);
|
||||
if (status == 0)
|
||||
{
|
||||
|
@ -1114,14 +1114,14 @@ test_config_settings(void)
|
|||
test_max_fsm = FSM_FOR_BUFS(test_buffs);
|
||||
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
"%s\"%s\" --boot -x0 %s "
|
||||
SYSTEMQUOTE "\"%s\" --boot -x0 %s "
|
||||
"-c max_connections=%d "
|
||||
"-c shared_buffers=%d "
|
||||
"-c max_fsm_pages=%d "
|
||||
"< \"%s\" > \"%s\" 2>&1%s",
|
||||
SYSTEMQUOTE, backend_exec, boot_options,
|
||||
"< \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
backend_exec, boot_options,
|
||||
n_connections, test_buffs, test_max_fsm,
|
||||
DEVNULL, DEVNULL, SYSTEMQUOTE);
|
||||
DEVNULL, DEVNULL);
|
||||
status = system(cmd);
|
||||
if (status == 0)
|
||||
break;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.99 2008/06/26 01:12:20 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.100 2008/06/26 01:35:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -361,13 +361,12 @@ start_postmaster(void)
|
|||
* everything to a shell to process them.
|
||||
*/
|
||||
if (log_file != NULL)
|
||||
snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s",
|
||||
SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts,
|
||||
DEVNULL, log_file, SYSTEMQUOTE);
|
||||
snprintf(cmd, MAXPGPATH, SYSTEMQUOTE "\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &" SYSTEMQUOTE,
|
||||
postgres_path, pgdata_opt, post_opts,
|
||||
DEVNULL, log_file);
|
||||
else
|
||||
snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" 2>&1 &%s",
|
||||
SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts,
|
||||
DEVNULL, SYSTEMQUOTE);
|
||||
snprintf(cmd, MAXPGPATH, SYSTEMQUOTE "\"%s\" %s%s < \"%s\" 2>&1 &" SYSTEMQUOTE,
|
||||
postgres_path, pgdata_opt, post_opts, DEVNULL);
|
||||
|
||||
return system(cmd);
|
||||
#else /* WIN32 */
|
||||
|
@ -380,13 +379,11 @@ start_postmaster(void)
|
|||
PROCESS_INFORMATION pi;
|
||||
|
||||
if (log_file != NULL)
|
||||
snprintf(cmd, MAXPGPATH, "CMD /C %s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s",
|
||||
SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts,
|
||||
DEVNULL, log_file, SYSTEMQUOTE);
|
||||
snprintf(cmd, MAXPGPATH, "CMD /C " SYSTEMQUOTE "\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
postgres_path, pgdata_opt, post_opts, DEVNULL, log_file);
|
||||
else
|
||||
snprintf(cmd, MAXPGPATH, "CMD /C %s\"%s\" %s%s < \"%s\" 2>&1%s",
|
||||
SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts,
|
||||
DEVNULL, SYSTEMQUOTE);
|
||||
snprintf(cmd, MAXPGPATH, "CMD /C " SYSTEMQUOTE "\"%s\" %s%s < \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
postgres_path, pgdata_opt, post_opts, DEVNULL);
|
||||
|
||||
if (!CreateRestrictedProcess(cmd, &pi))
|
||||
return GetLastError();
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.104 2008/04/13 03:49:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.105 2008/06/26 01:35:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@ -1248,18 +1248,18 @@ runPgDump(const char *dbname)
|
|||
if (filename)
|
||||
{
|
||||
#ifndef WIN32
|
||||
appendPQExpBuffer(cmd, "%s\"%s\" %s -Fa '", SYSTEMQUOTE, pg_dump_bin,
|
||||
appendPQExpBuffer(cmd, SYSTEMQUOTE"\"%s\" %s -Fa '", pg_dump_bin,
|
||||
#else
|
||||
appendPQExpBuffer(cmd, "%s\"%s\" %s -Fa \"", SYSTEMQUOTE, pg_dump_bin,
|
||||
appendPQExpBuffer(cmd, SYSTEMQUOTE"\"%s\" %s -Fa \"", pg_dump_bin,
|
||||
#endif
|
||||
pgdumpopts->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef WIN32
|
||||
appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp '", SYSTEMQUOTE, pg_dump_bin,
|
||||
appendPQExpBuffer(cmd, SYSTEMQUOTE "\"%s\" %s -Fp '", pg_dump_bin,
|
||||
#else
|
||||
appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp \"", SYSTEMQUOTE, pg_dump_bin,
|
||||
appendPQExpBuffer(cmd, SYSTEMQUOTE "\"%s\" %s -Fp \"", pg_dump_bin,
|
||||
#endif
|
||||
pgdumpopts->data);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.190 2008/06/11 10:48:17 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.191 2008/06/26 01:35:45 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "command.h"
|
||||
|
@ -1288,8 +1288,7 @@ editFile(const char *fname)
|
|||
#ifndef WIN32
|
||||
sprintf(sys, "exec %s '%s'", editorName, fname);
|
||||
#else
|
||||
sprintf(sys, "%s\"%s\" \"%s\"%s",
|
||||
SYSTEMQUOTE, editorName, fname, SYSTEMQUOTE);
|
||||
sprintf(sys, SYSTEMQUOTE "\"%s\" \"%s\"" SYSTEMQUOTE, editorName, fname);
|
||||
#endif
|
||||
result = system(sys);
|
||||
if (result == -1)
|
||||
|
@ -1790,9 +1789,8 @@ do_shell(const char *command)
|
|||
/* See EDITOR handling comment for an explaination */
|
||||
"exec %s", shellName);
|
||||
#else
|
||||
sprintf(sys,
|
||||
/* See EDITOR handling comment for an explaination */
|
||||
"%s\"%s\"%s", SYSTEMQUOTE, shellName, SYSTEMQUOTE);
|
||||
sprintf(sys, SYSTEMQUOTE "\"%s\"" SYSTEMQUOTE, shellName);
|
||||
#endif
|
||||
result = system(sys);
|
||||
free(sys);
|
||||
|
|
Loading…
Reference in New Issue