diff options
author | Magnus Hagander <magnus@hagander.net> | 2014-02-09 13:10:14 +0100 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2014-02-12 14:51:00 +0100 |
commit | 0ae288d2dd7c0b6725feebbcf799a4d65e057d05 (patch) | |
tree | d4fb4eb1426d63481e943558d9ded2bf28ad010c /src/bin/pg_basebackup/pg_receivexlog.c | |
parent | dd560510400e4cf545ac92a5d0270dde2e45c5dd (diff) | |
download | postgresql-0ae288d2dd7c0b6725feebbcf799a4d65e057d05.tar.gz postgresql-0ae288d2dd7c0b6725feebbcf799a4d65e057d05.zip |
Kill pg_basebackup background process when exiting
If an error occurs in the foreground (backup) process of pg_basebackup,
and we exit in a controlled way, the background process (streaming
xlog process) would stay around and keep streaming.
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivexlog.c')
-rw-r--r-- | src/bin/pg_basebackup/pg_receivexlog.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/pg_receivexlog.c b/src/bin/pg_basebackup/pg_receivexlog.c index b7df693f2dd..2d9f6c441b1 100644 --- a/src/bin/pg_basebackup/pg_receivexlog.c +++ b/src/bin/pg_basebackup/pg_receivexlog.c @@ -51,6 +51,13 @@ static void StreamLog(); static bool stop_streaming(XLogRecPtr segendpos, uint32 timeline, bool segment_finished); +#define disconnect_and_exit(code) \ + { \ + if (conn != NULL) PQfinish(conn); \ + exit(code); \ + } + + static void usage(void) { |