forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit65f4384
committed
Fix gai_strerror() thread-safety on Windows.
Commit5579388 removed code that supplied a fallback implementation ofgetaddrinfo(), which was dead code on modern systems. One tiny piece ofthe removed code was still doing something useful on Windows, though:that OS's own gai_strerror()/gai_strerrorA() function returns a pointerto a static buffer that it overwrites each time, so it's notthread-safe. In rare circumstances, a multi-threaded client programcould get an incorrect or corrupted error message.Restore the replacement gai_strerror() function, though now that it'sonly for Windows we can put it into a win32-specific file and cut itdown to the errors that Windows documents. The error messages here aretaken from FreeBSD, because Windows' own messages seemed too verbose.Back-patch to 16.Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Discussion:https://postgr.es/m/CA%2BhUKGKz%2BF9d2PTiXwfYV7qJw%2BWg2jzACgSDgPizUw7UG%3Di58A%40mail.gmail.com1 parente70abd6 commit65f4384
File tree
5 files changed
+61
-0
lines changed- src
- include/port/win32/sys
- port
5 files changed
+61
-0
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16388 | 16388 |
| |
16389 | 16389 |
| |
16390 | 16390 |
| |
| 16391 | + | |
| 16392 | + | |
| 16393 | + | |
| 16394 | + | |
| 16395 | + | |
| 16396 | + | |
16391 | 16397 |
| |
16392 | 16398 |
| |
16393 | 16399 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1885 | 1885 |
| |
1886 | 1886 |
| |
1887 | 1887 |
| |
| 1888 | + | |
1888 | 1889 |
| |
1889 | 1890 |
| |
1890 | 1891 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
23 | 23 |
| |
24 | 24 |
| |
25 | 25 |
| |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + |
0 commit comments
Comments
(0)