mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Fix some sloppiness in the new BufFileSize() and BufFileAppend() functions.
There were three related issues: * BufFileAppend() incorrectly reset the seek position on the 'source' file. As a result, if you had called BufFileRead() on the file before calling BufFileAppend(), it got confused, and subsequent calls would read/write at wrong position. * BufFileSize() did not work with files opened with BufFileOpenShared(). * FileGetSize() only worked on temporary files. To fix, change the way BufFileSize() works so that it works on shared files. Remove FileGetSize() altogether, as it's no longer needed. Remove buffilesize from TapeShare struct, as the leader process can simply call BufFileSize() to get the tape's size, there's no need to pass it through shared memory anymore. Discussion: https://www.postgresql.org/message-id/CAH2-WznEDYe_NZXxmnOfsoV54oFkTdMy7YLE2NPBLuttO96vTQ@mail.gmail.com
This commit is contained in:
@@ -2255,16 +2255,6 @@ FileGetRawMode(File file)
|
||||
return VfdCache[file].fileMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* FileGetSize - returns the size of file
|
||||
*/
|
||||
off_t
|
||||
FileGetSize(File file)
|
||||
{
|
||||
Assert(FileIsValid(file));
|
||||
return VfdCache[file].fileSize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make room for another allocatedDescs[] array entry if needed and possible.
|
||||
* Returns true if an array element is available.
|
||||
|
Reference in New Issue
Block a user