forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit50485b3
committed
Fix simple_prompt() to disable echo on Windows when stdin != terminal.
If echo = false, simple_prompt() is supposed to prevent echoing theinput (for password input). However, the Windows implementation appliedthe mode change to STD_INPUT_HANDLE. That would not have the desiredeffect if stdin isn't actually the terminal, for instance if the useris piping something into psql. Fix it to apply the mode change tothe correct input file, so that passwords do not echo in such cases.In passing, shorten and de-uglify this code by using #elif rather thanan #if nest and removing some duplicated code.Back-patch to all supported versions. To simplify that, also back-patchthe portions of commit9daec77 that got rid of an unnecessarymalloc/free in the same area.Matthew Stickney (cosmetic changes by me)Discussion:https://postgr.es/m/502a1fff-862b-da52-1031-f68df6ed5a2d@gmail.com1 parentb929614 commit50485b3
1 file changed
+16
-24
lines changedLines changed: 16 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
44 | 44 |
| |
45 | 45 |
| |
46 |
| - | |
47 |
| - | |
| 46 | + | |
48 | 47 |
| |
49 | 48 |
| |
50 | 49 |
| |
51 |
| - | |
52 | 50 |
| |
53 | 51 |
| |
54 | 52 |
| |
| |||
66 | 64 |
| |
67 | 65 |
| |
68 | 66 |
| |
| 67 | + | |
| 68 | + | |
| 69 | + | |
69 | 70 |
| |
70 |
| - | |
| 71 | + | |
71 | 72 |
| |
72 | 73 |
| |
73 | 74 |
| |
| |||
99 | 100 |
| |
100 | 101 |
| |
101 | 102 |
| |
102 |
| - | |
103 | 103 |
| |
104 | 104 |
| |
| 105 | + | |
| 106 | + | |
105 | 107 |
| |
106 | 108 |
| |
107 | 109 |
| |
108 | 110 |
| |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
113 |
| - | |
114 |
| - | |
115 |
| - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
116 | 114 |
| |
117 | 115 |
| |
118 | 116 |
| |
119 | 117 |
| |
120 | 118 |
| |
121 | 119 |
| |
122 |
| - | |
123 |
| - | |
124 | 120 |
| |
| 121 | + | |
125 | 122 |
| |
126 | 123 |
| |
127 | 124 |
| |
| |||
151 | 148 |
| |
152 | 149 |
| |
153 | 150 |
| |
154 |
| - | |
155 | 151 |
| |
156 | 152 |
| |
| 153 | + | |
| 154 | + | |
157 | 155 |
| |
158 | 156 |
| |
159 | 157 |
| |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
| 158 | + | |
166 | 159 |
| |
167 | 160 |
| |
168 | 161 |
| |
169 |
| - | |
170 |
| - | |
171 | 162 |
| |
| 163 | + | |
172 | 164 |
| |
173 | 165 |
| |
174 | 166 |
| |
|
0 commit comments
Comments
(0)