1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

pg_upgrade: Fix exec_prog API to be less flaky

The previous signature made it very easy to pass something other than
the printf-format specifier in the corresponding position, without any
warning from the compiler.

While at it, move some of the escaping, redirecting and quoting
responsibilities from the callers into exec_prog() itself.  This makes
the callsites cleaner.
This commit is contained in:
Alvaro Herrera
2012-08-27 14:21:09 -04:00
parent 34c02044ed
commit 088c065ce8
6 changed files with 96 additions and 113 deletions

View File

@ -316,10 +316,11 @@ void split_old_dump(void);
/* exec.c */
int
exec_prog(bool throw_error, bool is_priv, const char *log_file,
const char *opt_log_file, const char *cmd,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 5, 6)));
#define EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1"
bool
exec_prog(const char *log_file, const char *opt_log_file,
bool throw_error, const char *fmt,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 4, 5)));
void verify_directories(void);
bool is_server_running(const char *datadir);