forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0460e4e
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 parent4eb2611 commit0460e4e
File tree
6 files changed
+62
-0
lines changed- src
- include/port/win32/sys
- port
- tools/msvc
6 files changed
+62
-0
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16542 | 16542 |
| |
16543 | 16543 |
| |
16544 | 16544 |
| |
| 16545 | + | |
| 16546 | + | |
| 16547 | + | |
| 16548 | + | |
| 16549 | + | |
| 16550 | + | |
16545 | 16551 |
| |
16546 | 16552 |
| |
16547 | 16553 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1907 | 1907 |
| |
1908 | 1908 |
| |
1909 | 1909 |
| |
| 1910 | + | |
1910 | 1911 |
| |
1911 | 1912 |
| |
1912 | 1913 |
| |
|
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 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
| 116 | + | |
116 | 117 |
| |
117 | 118 |
| |
118 | 119 |
| |
|
0 commit comments
Comments
(0)