- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit7fed801
committed
Clean up inconsistent use of fflush().
More than twenty years ago (79fcde4), we hacked the postmasterto avoid a core-dump on systems that didn't support fflush(NULL).We've mostly, though not completely, hewed to that rule ever since.But such systems are surely gone in the wild, so in the spirit ofcleaning out no-longer-needed portability hacks let's get rid ofmultiple per-file fflush() calls in favor of using fflush(NULL).Also, we were fairly inconsistent about whether to fflush() beforepopen() and system() calls. While we've received no bug reportsabout that, it seems likely that at least some of these call sitesare at risk of odd behavior, such as error messages appearing inan unexpected order. Rather than expend a lot of brain cellsfiguring out which places are at hazard, let's just establish auniform coding rule that we should fflush(NULL) before these calls.A no-op fflush() is surely of trivial cost compared to launchinga sub-process via a shell; while if it's not a no-op then we likelyneed it.Discussion:https://postgr.es/m/2923412.1661722825@sss.pgh.pa.us1 parent2079653 commit7fed801
File tree
24 files changed
+52
-41
lines changed- src
- backend
- access/transam
- postmaster
- storage/file
- utils/error
- bin
- initdb
- pg_ctl
- pg_dump
- pg_rewind
- pg_upgrade
- pg_verifybackup
- pgbench
- psql
- common
- fe_utils
- interfaces/libpq
- test/regress
24 files changed
+52
-41
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
| 172 | + | |
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
| |||
358 | 359 |
| |
359 | 360 |
| |
360 | 361 |
| |
| 362 | + | |
361 | 363 |
| |
362 | 364 |
| |
363 | 365 |
| |
|
Lines changed: 1 addition & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 | 40 |
| |
45 |
| - | |
46 |
| - | |
| 41 | + | |
47 | 42 |
| |
48 | 43 |
| |
49 | 44 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
99 | 99 |
| |
100 | 100 |
| |
101 | 101 |
| |
| 102 | + | |
102 | 103 |
| |
103 | 104 |
| |
104 | 105 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2503 | 2503 |
| |
2504 | 2504 |
| |
2505 | 2505 |
| |
2506 |
| - | |
2507 |
| - | |
| 2506 | + | |
2508 | 2507 |
| |
2509 | 2508 |
| |
2510 | 2509 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
643 | 643 |
| |
644 | 644 |
| |
645 | 645 |
| |
646 |
| - | |
647 |
| - | |
| 646 | + | |
648 | 647 |
| |
649 | 648 |
| |
650 | 649 |
| |
| |||
670 | 669 |
| |
671 | 670 |
| |
672 | 671 |
| |
673 |
| - | |
674 |
| - | |
| 672 | + | |
675 | 673 |
| |
676 | 674 |
| |
677 | 675 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
489 | 489 |
| |
490 | 490 |
| |
491 | 491 |
| |
492 |
| - | |
493 |
| - | |
| 492 | + | |
494 | 493 |
| |
495 | 494 |
| |
496 | 495 |
| |
| |||
914 | 913 |
| |
915 | 914 |
| |
916 | 915 |
| |
| 916 | + | |
917 | 917 |
| |
918 | 918 |
| |
919 | 919 |
| |
| |||
950 | 950 |
| |
951 | 951 |
| |
952 | 952 |
| |
| 953 | + | |
953 | 954 |
| |
954 | 955 |
| |
955 | 956 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
448 | 448 |
| |
449 | 449 |
| |
450 | 450 |
| |
451 |
| - | |
452 |
| - | |
| 451 | + | |
453 | 452 |
| |
454 | 453 |
| |
455 | 454 |
| |
| |||
916 | 915 |
| |
917 | 916 |
| |
918 | 917 |
| |
| 918 | + | |
919 | 919 |
| |
920 | 920 |
| |
921 | 921 |
| |
| |||
2222 | 2222 |
| |
2223 | 2223 |
| |
2224 | 2224 |
| |
| 2225 | + | |
2225 | 2226 |
| |
2226 | 2227 |
| |
2227 | 2228 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1578 | 1578 |
| |
1579 | 1579 |
| |
1580 | 1580 |
| |
1581 |
| - | |
1582 |
| - | |
| 1581 | + | |
1583 | 1582 |
| |
1584 | 1583 |
| |
1585 | 1584 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1151 | 1151 |
| |
1152 | 1152 |
| |
1153 | 1153 |
| |
| 1154 | + | |
1154 | 1155 |
| |
1155 | 1156 |
| |
1156 | 1157 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
123 | 123 |
| |
124 | 124 |
| |
125 | 125 |
| |
126 |
| - | |
127 |
| - | |
| 126 | + | |
128 | 127 |
| |
129 | 128 |
| |
130 | 129 |
| |
| |||
191 | 190 |
| |
192 | 191 |
| |
193 | 192 |
| |
194 |
| - | |
195 |
| - | |
| 193 | + | |
196 | 194 |
| |
197 | 195 |
| |
198 | 196 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
| |||
125 | 126 |
| |
126 | 127 |
| |
127 | 128 |
| |
| 129 | + | |
| 130 | + | |
128 | 131 |
| |
| 132 | + | |
129 | 133 |
| |
130 | 134 |
| |
131 | 135 |
| |
| |||
174 | 178 |
| |
175 | 179 |
| |
176 | 180 |
| |
| 181 | + | |
| 182 | + | |
177 | 183 |
| |
| 184 | + | |
178 | 185 |
| |
179 | 186 |
| |
180 | 187 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
416 | 416 |
| |
417 | 417 |
| |
418 | 418 |
| |
| 419 | + | |
419 | 420 |
| |
420 | 421 |
| |
421 | 422 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
811 | 811 |
| |
812 | 812 |
| |
813 | 813 |
| |
| 814 | + | |
814 | 815 |
| |
815 | 816 |
| |
816 | 817 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2973 | 2973 |
| |
2974 | 2974 |
| |
2975 | 2975 |
| |
| 2976 | + | |
| 2977 | + | |
2976 | 2978 |
| |
2977 | 2979 |
| |
2978 | 2980 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2661 | 2661 |
| |
2662 | 2662 |
| |
2663 | 2663 |
| |
| 2664 | + | |
2664 | 2665 |
| |
2665 | 2666 |
| |
2666 | 2667 |
| |
| |||
3834 | 3835 |
| |
3835 | 3836 |
| |
3836 | 3837 |
| |
| 3838 | + | |
3837 | 3839 |
| |
3838 | 3840 |
| |
3839 | 3841 |
| |
| |||
4956 | 4958 |
| |
4957 | 4959 |
| |
4958 | 4960 |
| |
| 4961 | + | |
4959 | 4962 |
| |
4960 | 4963 |
| |
4961 | 4964 |
| |
| |||
5065 | 5068 |
| |
5066 | 5069 |
| |
5067 | 5070 |
| |
| 5071 | + | |
5068 | 5072 |
| |
5069 | 5073 |
| |
5070 | 5074 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
| 62 | + | |
62 | 63 |
| |
63 | 64 |
| |
64 | 65 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
288 | 288 |
| |
289 | 289 |
| |
290 | 290 |
| |
291 |
| - | |
292 |
| - | |
| 291 | + | |
293 | 292 |
| |
294 | 293 |
| |
295 | 294 |
| |
| |||
307 | 306 |
| |
308 | 307 |
| |
309 | 308 |
| |
310 |
| - | |
311 |
| - | |
312 |
| - | |
| 309 | + | |
313 | 310 |
| |
| 311 | + | |
314 | 312 |
| |
315 | 313 |
| |
316 | 314 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
266 | 266 |
| |
267 | 267 |
| |
268 | 268 |
| |
269 |
| - | |
| 269 | + | |
270 | 270 |
| |
| 271 | + | |
| 272 | + | |
271 | 273 |
| |
272 | 274 |
| |
273 | 275 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
777 | 777 |
| |
778 | 778 |
| |
779 | 779 |
| |
| 780 | + | |
780 | 781 |
| |
781 | 782 |
| |
782 | 783 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
388 | 388 |
| |
389 | 389 |
| |
390 | 390 |
| |
391 |
| - | |
392 |
| - | |
393 |
| - | |
| 391 | + | |
394 | 392 |
| |
395 | 393 |
| |
396 | 394 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
| 58 | + | |
58 | 59 |
| |
59 | 60 |
| |
60 | 61 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3118 | 3118 |
| |
3119 | 3119 |
| |
3120 | 3120 |
| |
| 3121 | + | |
3121 | 3122 |
| |
3122 | 3123 |
| |
3123 | 3124 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
| 183 | + | |
183 | 184 |
| |
184 | 185 |
| |
185 | 186 |
| |
|
0 commit comments
Comments
(0)