forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit10260c7
committed
Fix fstat() emulation on Windows with standard streams
The emulation of fstat() in win32stat.c caused two issues with theexisting in-core callers, failing on EINVAL when using a stream asargument:- psql's \copy would crash when using a stream.- pg_recvlogical would fail with -f -.The tests in copyselect.sql from the main test suite covers the firstcase, and there is a TAP test for the second case. However, in bothcases, as the standard streams are always redirected, automated testsdid not notice those issues, requiring a terminal on Windows to bereproducible.This issue has been introduced inbed9075, and the origin of the problemis that GetFileInformationByHandle() does not work directly on streams,so this commit adds an extra code path to emulate and return a set ofstats that match best with the reality. Note that redirected streamsrely on handles that can be queried with GetFileInformationByHandle(),but we can rely on GetFinalPathNameByHandleA() to detect this case.Author: Dmitry Koval, Juan José Santamaría FlechaDiscussion:https://postgr.es/m/17288-6b58a91025a8a8a3@postgresql.orgBackpatch-through: 141 parent3030903 commit10260c7
1 file changed
+20
-0
lines changedLines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
289 | 289 |
| |
290 | 290 |
| |
291 | 291 |
| |
| 292 | + | |
292 | 293 |
| |
293 | 294 |
| |
294 | 295 |
| |
295 | 296 |
| |
296 | 297 |
| |
297 | 298 |
| |
298 | 299 |
| |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
299 | 319 |
| |
300 | 320 |
| |
301 | 321 |
| |
|
0 commit comments
Comments
(0)