aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_basebackup/pg_receivewal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_basebackup/pg_receivewal.c')
-rw-r--r--src/bin/pg_basebackup/pg_receivewal.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index 23cf5f8ec74..4b1439be904 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -917,10 +917,6 @@ main(int argc, char **argv)
close_destination_dir(dir, basedir);
}
-#ifndef WIN32
- pqsignal(SIGINT, sigint_handler);
-#endif
-
/*
* Obtain a connection before doing anything.
*/
@@ -931,6 +927,14 @@ main(int argc, char **argv)
atexit(disconnect_atexit);
/*
+ * Trap signals. (Don't do this until after the initial password prompt,
+ * if one is needed, in GetConnection.)
+ */
+#ifndef WIN32
+ pqsignal(SIGINT, sigint_handler);
+#endif
+
+ /*
* Run IDENTIFY_SYSTEM to make sure we've successfully have established a
* replication connection and haven't connected using a database specific
* connection.