Commit 376ce3e
committed
Prefer $HOME when looking up the current user's home directory.
When we need to identify the home directory on non-Windows, first
consult getenv("HOME"). If that's empty or unset, fall back
on our previous method of checking the <pwd.h> database.
Preferring $HOME allows the user to intentionally point at some
other directory, and it seems to be in line with the behavior of
most other utilities. However, we shouldn't rely on it completely,
as $HOME is likely to be unset when running as a daemon.
Anders Kaseorg
Discussion: https://postgr.es/m/1634252654444.90107@mit.edu1 parent 6867f96 commit 376ce3e
File tree
3 files changed
+51
-26
lines changed- src
- bin/psql
- interfaces/libpq
- port
3 files changed
+51
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
567 | 564 | | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
572 | 579 | | |
573 | | - | |
574 | 580 | | |
575 | 581 | | |
576 | 582 | | |
| |||
581 | 587 | | |
582 | 588 | | |
583 | 589 | | |
584 | | - | |
| 590 | + | |
| 591 | + | |
585 | 592 | | |
586 | 593 | | |
587 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7267 | 7267 | | |
7268 | 7268 | | |
7269 | 7269 | | |
7270 | | - | |
7271 | | - | |
7272 | | - | |
| 7270 | + | |
7273 | 7271 | | |
7274 | | - | |
7275 | | - | |
7276 | | - | |
7277 | | - | |
| 7272 | + | |
| 7273 | + | |
| 7274 | + | |
| 7275 | + | |
| 7276 | + | |
| 7277 | + | |
| 7278 | + | |
| 7279 | + | |
| 7280 | + | |
| 7281 | + | |
| 7282 | + | |
| 7283 | + | |
| 7284 | + | |
7278 | 7285 | | |
7279 | 7286 | | |
7280 | 7287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
810 | | - | |
811 | | - | |
812 | | - | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
813 | 815 | | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
818 | 829 | | |
819 | 830 | | |
820 | 831 | | |
| |||
0 commit comments