Commit 93c301f
committed
Fix multiple bugs in tablespace symlink removal.
Don't try to examine S_ISLNK(st.st_mode) after a failed lstat().
It's undefined.
Also, if the lstat() reported ENOENT, we do not wish that to be a hard
error, but the code might nonetheless treat it as one (giving an entirely
misleading error message, too) depending on luck-of-the-draw as to what
S_ISLNK() returned.
Don't throw error for ENOENT from rmdir(), either. (We're not really
expecting ENOENT because we just stat'd the file successfully; but
if we're going to allow ENOENT in the symlink code path, surely the
directory code path should too.)
Generate an appropriate errcode for its-the-wrong-type-of-file complaints.
(ERRCODE_SYSTEM_ERROR doesn't seem appropriate, and failing to write
errcode() around it certainly doesn't work, and not writing an errcode
at all is not per project policy.)
Valgrind noticed the undefined S_ISLNK result; the other problems emerged
while reading the code in the area.
All of this appears to have been introduced in 8f15f74.
Back-patch to 9.5 where that commit appeared.1 parent 752b948 commit 93c301f
1 file changed
+23
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
777 | 786 | | |
778 | 787 | | |
779 | | - | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
780 | 792 | | |
781 | 793 | | |
782 | 794 | | |
| 795 | + | |
783 | 796 | | |
784 | 797 | | |
785 | 798 | | |
| |||
799 | 812 | | |
800 | 813 | | |
801 | 814 | | |
802 | | - | |
| 815 | + | |
803 | 816 | | |
804 | 817 | | |
805 | 818 | | |
| |||
851 | 864 | | |
852 | 865 | | |
853 | 866 | | |
854 | | - | |
| 867 | + | |
855 | 868 | | |
856 | 869 | | |
857 | 870 | | |
| |||
863 | 876 | | |
864 | 877 | | |
865 | 878 | | |
866 | | - | |
867 | | - | |
| 879 | + | |
| 880 | + | |
868 | 881 | | |
869 | | - | |
| 882 | + | |
870 | 883 | | |
871 | 884 | | |
872 | 885 | | |
| |||
878 | 891 | | |
879 | 892 | | |
880 | 893 | | |
881 | | - | |
| 894 | + | |
882 | 895 | | |
883 | 896 | | |
884 | 897 | | |
885 | 898 | | |
886 | 899 | | |
887 | 900 | | |
888 | 901 | | |
889 | | - | |
| 902 | + | |
| 903 | + | |
890 | 904 | | |
891 | 905 | | |
892 | 906 | | |
| |||
0 commit comments