Document limitations.
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.35 2004/06/03 00:07:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.36 2004/06/10 16:35:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < len; i++)
{
snprintf(cmd, sizeof(cmd),
- "\"%s\" -boot -x0 %s "
+ "%s\"%s\" -boot -x0 %s "
"-c shared_buffers=%d -c max_connections=%d template1 "
- "<%s >%s 2>&1",
- backend_exec, boot_options,
+ "< \"%s\" > \"%s\" 2>&1%s",
+ SYSTEMQUOTE, backend_exec, boot_options,
conns[i] * 5, conns[i],
- DEVNULL, DEVNULL);
+ DEVNULL, DEVNULL, SYSTEMQUOTE);
status = system(cmd);
if (status == 0)
break;
for (i = 0; i < len; i++)
{
snprintf(cmd, sizeof(cmd),
- "\"%s\" -boot -x0 %s "
+ "%s\"%s\" -boot -x0 %s "
"-c shared_buffers=%d -c max_connections=%d template1 "
- "<%s >%s 2>&1",
- backend_exec, boot_options,
+ "< \"%s\" > \"%s\" 2>&1%s",
+ SYSTEMQUOTE, backend_exec, boot_options,
bufs[i], n_connections,
- DEVNULL, DEVNULL);
+ DEVNULL, DEVNULL, SYSTEMQUOTE);
status = system(cmd);
if (status == 0)
break;
*
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.8 2004/06/09 17:36:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.9 2004/06/10 16:35:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Does '&' work on Win32? */
if (log_file != NULL)
- snprintf(cmd, MAXPGPATH, "'%s' %s < %s >> '%s' 2>&1 &",
- postgres_path, post_opts, DEVNULL, log_file);
+ snprintf(cmd, MAXPGPATH, "%s\"%s\" %s < %s >> \"%s\" 2>&1 &%s",
+ SYSTEMQUOTE, postgres_path, post_opts, DEVNULL, log_file,
+ SYSTEMQUOTE);
else
- snprintf(cmd, MAXPGPATH, "'%s' %s < %s 2>&1 &",
- postgres_path, post_opts, DEVNULL);
+ snprintf(cmd, MAXPGPATH, "%s\"%s\" %s < \"%s\" 2>&1 &%s",
+ SYSTEMQUOTE, postgres_path, post_opts, DEVNULL, SYSTEMQUOTE);
return system(cmd);
}
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.40 2004/06/09 17:37:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.41 2004/06/10 16:35:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
const char *p;
int ret;
- appendPQExpBuffer(cmd, "'%s' %s -Fp '", pg_dump_bin, pgdumpopts->data);
+ appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp '", SYSTEMQUOTE, pg_dump_bin,
+ pgdumpopts->data);
/* Shell quoting is not quite like SQL quoting, so can't use fmtId */
for (p = dbname; *p; p++)
}
appendPQExpBufferChar(cmd, '\'');
+ appendStringLiteral(cmd, SYSTEMQUOTE, false);
if (verbose)
fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data);
* 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.40 2004/06/03 00:07:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.41 2004/06/10 16:35:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define DEVNULL "/dev/null"
#endif
+/*
+ * Win32 needs double quotes at the beginning and end of system()
+ * strings. If not, it gets confused with multiple quoted strings.
+ * It also must use double-quotes around the executable name
+ * and any files use for redirection. Other args can use single-quotes.
+ */
+#ifdef WIN32
+#define SYSTEMQUOTE "\""
+#else
+#define SYSTEMQUOTE ""
+#endif
+
/* Portable delay handling */
extern void pg_usleep(long microsec);