mirror of
https://github.com/postgres/postgres.git
synced 2025-06-03 01:21:48 +03:00
Fix failure-to-read-man-page in commit 899bd785c.
posix_fallocate() is not quite a drop-in replacement for fallocate(), because it is defined to return the error code as its function result, not in "errno". I (tgl) missed this because RHEL6's version seems to set errno as well. That is not the case on more modern Linuxen, though, as per buildfarm results. Aside from fixing the return-convention confusion, remove the test for ENOSYS; we expect that glibc will mask that for posix_fallocate, though it does not for fallocate. Keep the test for EINTR, because POSIX specifies that as a possible result, and buildfarm results suggest that it can happen in practice. Back-patch to 9.4, like the previous commit. Thomas Munro Discussion: https://postgr.es/m/1002664500.12301802.1471008223422.JavaMail.yahoo@mail.yahoo.com
This commit is contained in:
parent
01c5de88ff
commit
d29f30d8c3
@ -425,17 +425,14 @@ dsm_impl_posix_resize(int fd, off_t size)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
rc = posix_fallocate(fd, 0, size);
|
rc = posix_fallocate(fd, 0, size);
|
||||||
} while (rc == -1 && errno == EINTR);
|
} while (rc == EINTR);
|
||||||
|
|
||||||
if (rc != 0 && errno == ENOSYS)
|
/*
|
||||||
{
|
* The caller expects errno to be set, but posix_fallocate() doesn't
|
||||||
/*
|
* set it. Instead it returns error numbers directly. So set errno,
|
||||||
* Kernel too old (< 2.6.23). Rather than fail, just trust that
|
* even though we'll also return rc to indicate success or failure.
|
||||||
* we won't hit the problem (it typically doesn't show up without
|
*/
|
||||||
* many-GB-sized requests, anyway).
|
errno = rc;
|
||||||
*/
|
|
||||||
rc = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
|
#endif /* HAVE_POSIX_FALLOCATE && __linux__ */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user