forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit754b90f
committed
Fix error handling of readdir() port implementation on first file lookup
The implementation of readdir() in src/port/ which gets used by MSVC hasbeen added in399a36a, and since the beginning it considers all errorson the first file lookup as ENOENT, setting errno accordingly andletting the routine caller think that the directory is empty. Whilethis is normally enough for the case of the backend, this can confusecallers of this routine on Windows as all errors would map to the samebehavior. So, for example, even permission errors would be thought ashaving an empty directory, while there could be contents in it.This commit changes the error handling so as readdir() gets a behaviorsimilar to native implementations: force errno=0 when seeingERROR_FILE_NOT_FOUND as error and consider other errors as plainfailures.While looking at the patch, I noticed that MinGW does not enforceerrno=0 when looking at the first file, but it gets enforced on the nextfile lookups. A comment related to that was incorrect in the code.Reported-by: Yuri KurenkovDiagnosed-by: Yuri Kurenkov, Grigory SmolkinAuthor:Konstantin KnizhnikReviewed-by: Andrew Dunstan, Michael PaquierDiscussion:https://postgr.es/m/2cad7829-8d66-e39c-b937-ac825db5203d@postgrespro.ruBackpatch-through: 9.41 parent5bd9160 commit754b90f
1 file changed
+8
-6
lines changedLines changed: 8 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
86 |
| - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
87 | 91 |
| |
88 | 92 |
| |
89 | 93 |
| |
90 | 94 |
| |
91 | 95 |
| |
92 | 96 |
| |
93 | 97 |
| |
| 98 | + | |
94 | 99 |
| |
95 |
| - | |
96 |
| - | |
97 | 100 |
| |
98 |
| - | |
99 |
| - | |
100 |
| - | |
| 101 | + | |
| 102 | + | |
101 | 103 |
| |
102 | 104 |
| |
103 | 105 |
| |
|
0 commit comments
Comments
(0)