forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite02ea14
committed
Try again to work around Windows' ERROR_SHARING_VIOLATION in pg_ctl.
Commit0da33c7 introduced an unfortunate regression in pg_ctl onWindows: if the log file specified with -l doesn't exist yet, andpg_ctl is running with Administrator privileges, then the log filemight get created with permissions that prevent the postmaster fromwriting on it. (It seems that whether this happens depends on whetherthe log file is inside the user's home directory or not, and perhapson other phase-of-the-moon conditions, which may explain why we failedto notice it sooner.)To fix, just don't create the log file if it doesn't exist yet. Thecase where we need to wait obviously only occurs with a pre-existinglog file.In passing, switch from using fopen() to plain open(), saving a fewcycles.Per bug #16259 from Jonathan Katz and Heath Lord. Back-patch to v12,as the faulty commit was.Alexander LakhinDiscussion:https://postgr.es/m/16259-c5ebed32a262a8b1@postgresql.org1 parentfaade5d commite02ea14
1 file changed
+21
-7
lines changedLines changed: 21 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
521 | 521 |
| |
522 | 522 |
| |
523 | 523 |
| |
524 |
| - | |
| 524 | + | |
525 | 525 |
| |
526 | 526 |
| |
527 | 527 |
| |
528 | 528 |
| |
529 | 529 |
| |
530 | 530 |
| |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
531 | 536 |
| |
532 |
| - | |
| 537 | + | |
533 | 538 |
| |
534 |
| - | |
| 539 | + | |
535 | 540 |
| |
536 |
| - | |
537 |
| - | |
538 |
| - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
539 | 552 |
| |
540 |
| - | |
| 553 | + | |
| 554 | + | |
541 | 555 |
| |
542 | 556 |
| |
543 | 557 |
| |
|
0 commit comments
Comments
(0)