forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6d1a854
committed
Avoid calling gettext() in signal handlers.
It seems highly unlikely that gettext() can be relied on to beasync-signal-safe. psql used to understand that, but someone gotit wrong long ago in the src/bin/scripts/ version of handle_sigint,and then the bad idea was perpetuated when those two versions wereunified into src/fe_utils/cancel.c.I'm unsure why there have not been field complaints about this... maybe gettext() is signal-safe once it's translated at leastone message? But we have no business assuming any such thing.In cancel.c (v13 and up), I preserved our ability to localize"Cancel request sent" messages by invoking gettext() beforethe signal handler is set up. In earlier branches I just madesrc/bin/scripts/ not localize those messages, as psql did then.(Just for extra unsafety, the src/bin/scripts/ version wasinvoking fprintf() from a signal handler. Sigh.)Noted while fixing signal-safety issues in PQcancel() itself.Back-patch to all supported branches.Discussion:https://postgr.es/m/2937814.1641960929@sss.pgh.pa.us1 parent38f099e commit6d1a854
1 file changed
+23
-4
lines changedLines changed: 23 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
26 | 39 |
| |
27 | 40 |
| |
28 | 41 |
| |
| |||
485 | 498 |
| |
486 | 499 |
| |
487 | 500 |
| |
488 |
| - | |
| 501 | + | |
489 | 502 |
| |
490 | 503 |
| |
491 |
| - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
492 | 508 |
| |
493 | 509 |
| |
494 | 510 |
| |
| |||
522 | 538 |
| |
523 | 539 |
| |
524 | 540 |
| |
525 |
| - | |
526 | 541 |
| |
| 542 | + | |
527 | 543 |
| |
528 | 544 |
| |
529 |
| - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
530 | 549 |
| |
531 | 550 |
| |
532 | 551 |
| |
|
0 commit comments
Comments
(0)