aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-12-06 10:11:36 +0100
committerPeter Eisentraut <peter@eisentraut.org>2023-12-06 10:11:36 +0100
commit52e98d45023027de0fa8e4eee2d53e2c20185812 (patch)
tree8e198cc1709bb9e7e78b1f790bf0972b793445f9
parent7636725b922c8cd68f21d040f3542d3bce9c68a4 (diff)
downloadpostgresql-52e98d45023027de0fa8e4eee2d53e2c20185812.tar.gz
postgresql-52e98d45023027de0fa8e4eee2d53e2c20185812.zip
Use signal-safe functions in signal handler
According to signal-safety(7), exit(3) and puts(3) are not safe to call in a signal handler. Author: Tristan Partin <tristan@neon.tech> Discussion: https://www.postgresql.org/message-id/flat/CTVDKVZCCVSY.1XQ87UL50KQRD%40gonk
-rw-r--r--src/bin/pg_test_fsync/pg_test_fsync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index f56e494f70f..f109aa57174 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -602,8 +602,8 @@ signal_cleanup(SIGNAL_ARGS)
if (needs_unlink)
unlink(filename);
/* Finish incomplete line on stdout */
- puts("");
- exit(1);
+ write(STDOUT_FILENO, "\n", 1);
+ _exit(1);
}
#ifdef HAVE_FSYNC_WRITETHROUGH