mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Calling fseek() or ftello() on a handle to a non-seeking device such as
a pipe or a communications device is not supported. Unfortunately,
MSVC's flavor of these routines, _fseeki64() and _ftelli64(), do not
return an error when given a pipe as handle. Some of the logic of
pg_dump and restore relies on these routines to check if a handle is
seekable, causing failures when passing the contents of pg_dump to
pg_restore through a pipe, for example.
This commit introduces wrappers for fseeko() and ftello() on MSVC so as
any callers are able to properly detect the cases of non-seekable
handles. This relies mainly on GetFileType(), sharing a bit of code
with the MSVC port for fstat(). The code in charge of getting a file
type is refactored into a new file called win32common.c, shared by
win32stat.c and the new win32fseek.c. It includes the MSVC ports for
fseeko() and ftello().
Like
|
||
|---|---|---|
| .. | ||
| atomics | ||
| win32 | ||
| win32_msvc | ||
| aix.h | ||
| atomics.h | ||
| cygwin.h | ||
| darwin.h | ||
| freebsd.h | ||
| linux.h | ||
| netbsd.h | ||
| openbsd.h | ||
| pg_bitutils.h | ||
| pg_bswap.h | ||
| pg_crc32c.h | ||
| pg_iovec.h | ||
| pg_lfind.h | ||
| pg_pthread.h | ||
| simd.h | ||
| solaris.h | ||
| win32.h | ||
| win32_port.h | ||
| win32ntdll.h | ||