Re: stat() on Windows might cause error if target file is largerthan 4GB
От | Michael Paquier |
---|---|
Тема | Re: stat() on Windows might cause error if target file is largerthan 4GB |
Дата | |
Msg-id | 20180913000911.GC1387@paquier.xyz обсуждение исходный текст |
Ответ на | Re: stat() on Windows might cause error if target file is largerthan 4GB (Michael Paquier <michael@paquier.xyz>) |
Ответы |
Re: stat() on Windows might cause error if target file is larger than 4GB
|
Список | pgsql-hackers |
On Wed, Sep 12, 2018 at 12:47:31PM +0900, Michael Paquier wrote: > That's exactly what I would like to do and what I meant two paragraphs > above as that's the only solution I think would be clean, and this would > take care of st_size nicely. I have not tested (yet), but some tweaks > in win32_port.h could be enough before mapping lstat to stat? FWIW, I have been digging into this one and as "struct stat" is already an existing structure when it comes to MSVC, enforcing a mapping of __stat64 to that is proving to be tedious in one of the port headers. Another solution would be to modify pgwin32_safestat so as it directly uses _stat64, and then fill in the results from __stat64 directly to _stat field by field. One thing which would be bad is that _stat.st_size is 4 bytes, which would cause the eight high bytes of __stat64.st_size to be lost, hence if working on a file larger than 4GB we would send an incorrect size back to the caller, which is worse than the OVERFLOW we have now. We had better be careful with MinGW as well, and cygwin does not take this path. Perhaps somebody has a smart idea? -- Michael
Вложения
В списке pgsql-hackers по дате отправления: