forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit98c6231
committed
Fix incorrect data type choices in some read and write calls.
Recently-introduced code in reconstruct.c was using "unsigned"to store the result of read(), pg_pread(), or write(). This iscompletely bogus: it breaks subsequent tests for the result beingnegative, as we're being reminded of by a chorus of buildfarmwarnings. Switch to "int" as was doubtless intended. (There areseveral other uses of "unsigned" in this file that also look poorlychosen to me, but for now I'm just trying to clean up the buildfarm.)A larger problem is that "int" is not necessarily wide enough to holdthe result: per POSIX, all these functions return ssize_t. In placeswhere the requested read or write length clearly fits in int, that'sacademic. It may be academic anyway as long as we constrainindividual data files to 1GB, since even a readv or writev-likeoperation would then not be responsible for transferring more than1GB. Nonetheless it seems like trouble waiting to happen, so I madea pass over readv and writev calls and fixed the result variableswhere that seemed appropriate. We might want to think about changingsome of the fd.c functions to return ssize_t too, for future-proofing;but I didn't tackle that here.Discussion:https://postgr.es/m/1672202.1703441340@sss.pgh.pa.us1 parentda083b2 commit98c6231
File tree
3 files changed
+15
-15
lines changed- src
- backend
- access/transam
- backup
- bin/pg_combinebackup
3 files changed
+15
-15
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2280 | 2280 |
| |
2281 | 2281 |
| |
2282 | 2282 |
| |
2283 |
| - | |
| 2283 | + | |
2284 | 2284 |
| |
2285 | 2285 |
| |
2286 | 2286 |
| |
|
Lines changed: 6 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 |
| - | |
121 |
| - | |
| 120 | + | |
| 121 | + | |
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| |||
525 | 525 |
| |
526 | 526 |
| |
527 | 527 |
| |
528 |
| - | |
| 528 | + | |
529 | 529 |
| |
530 | 530 |
| |
531 | 531 |
| |
| |||
2079 | 2079 |
| |
2080 | 2080 |
| |
2081 | 2081 |
| |
2082 |
| - | |
| 2082 | + | |
2083 | 2083 |
| |
2084 | 2084 |
| |
2085 | 2085 |
| |
2086 |
| - | |
| 2086 | + | |
2087 | 2087 |
| |
2088 | 2088 |
| |
2089 | 2089 |
| |
| |||
2096 | 2096 |
| |
2097 | 2097 |
| |
2098 | 2098 |
| |
2099 |
| - | |
| 2099 | + | |
2100 | 2100 |
| |
2101 | 2101 |
| |
2102 | 2102 |
| |
|
Lines changed: 8 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
504 | 504 |
| |
505 | 505 |
| |
506 | 506 |
| |
507 |
| - | |
| 507 | + | |
508 | 508 |
| |
509 | 509 |
| |
510 | 510 |
| |
511 | 511 |
| |
512 | 512 |
| |
513 | 513 |
| |
514 | 514 |
| |
515 |
| - | |
| 515 | + | |
516 | 516 |
| |
517 | 517 |
| |
518 | 518 |
| |
| |||
614 | 614 |
| |
615 | 615 |
| |
616 | 616 |
| |
617 |
| - | |
| 617 | + | |
618 | 618 |
| |
619 | 619 |
| |
620 | 620 |
| |
| |||
641 | 641 |
| |
642 | 642 |
| |
643 | 643 |
| |
644 |
| - | |
| 644 | + | |
645 | 645 |
| |
646 | 646 |
| |
647 | 647 |
| |
| |||
650 | 650 |
| |
651 | 651 |
| |
652 | 652 |
| |
653 |
| - | |
654 |
| - | |
655 |
| - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
| |||
663 | 663 |
| |
664 | 664 |
| |
665 | 665 |
| |
666 |
| - | |
| 666 | + | |
667 | 667 |
| |
668 | 668 |
| |
669 | 669 |
| |
|
0 commit comments
Comments
(0)