Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 52e98d4

Browse files
committed
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
1 parent 7636725 commit 52e98d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/pg_test_fsync/pg_test_fsync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ signal_cleanup(SIGNAL_ARGS)
602602
if (needs_unlink)
603603
unlink(filename);
604604
/* Finish incomplete line on stdout */
605-
puts("");
606-
exit(1);
605+
write(STDOUT_FILENO, "\n", 1);
606+
_exit(1);
607607
}
608608

609609
#ifdef HAVE_FSYNC_WRITETHROUGH

0 commit comments

Comments
 (0)