postgresql/src
Tom Lane 98c6231d19 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 is
completely bogus: it breaks subsequent tests for the result being
negative, as we're being reminded of by a chorus of buildfarm
warnings.  Switch to "int" as was doubtless intended.  (There are
several other uses of "unsigned" in this file that also look poorly
chosen 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 hold
the result: per POSIX, all these functions return ssize_t.  In places
where the requested read or write length clearly fits in int, that's
academic.  It may be academic anyway as long as we constrain
individual data files to 1GB, since even a readv or writev-like
operation would then not be responsible for transferring more than
1GB.  Nonetheless it seems like trouble waiting to happen, so I made
a pass over readv and writev calls and fixed the result variables
where that seemed appropriate.  We might want to think about changing
some 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.us
2023-12-27 11:02:53 -05:00
..
backend Fix incorrect data type choices in some read and write calls. 2023-12-27 11:02:53 -05:00
bin Fix incorrect data type choices in some read and write calls. 2023-12-27 11:02:53 -05:00
common Fix erroneous -Werror=missing-braces on old GCC. 2023-12-24 23:36:33 -05:00
fe_utils Remove unneeded assignments in for loop header 2023-11-21 16:10:27 +01:00
include Improvements and fixes for e0b1ee17dc 2023-12-27 14:35:08 +02:00
interfaces Remove MSVC scripts 2023-12-20 09:44:37 +09:00
makefiles Remove distprep 2023-11-06 15:18:04 +01:00
pl Fix mistaken file name in plpython's meson recipe. 2023-12-26 17:03:02 -05:00
port Remove MSVC scripts 2023-12-20 09:44:37 +09:00
template
test Make replace_relid() leave argument unmodified 2023-12-27 03:57:57 +02:00
timezone Remove distprep 2023-11-06 15:18:04 +01:00
tools Stop generating plain-text INSTALL instructions. 2023-12-22 13:32:15 -05:00
tutorial
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Initialize data directories with --lc-messages=C for tests. 2023-12-21 15:10:13 -08:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
meson.build
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00