mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Fix Posix/CIFS error messages reporting the wrong filename on write/sync/close.
The reported file name was the destination file, not the temp file that is written to during atomic write operations.
This commit is contained in:
parent
4c13955c05
commit
0d4ba3a39f
@ -14,6 +14,12 @@
|
||||
<release-list>
|
||||
<release date="XXXX-XX-XX" version="2.13dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
<release-item>
|
||||
<p>Fix <proper>Posix</proper>/<proper>CIFS</proper> error messages reporting the wrong filename on write/sync/close.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-development-list>
|
||||
<release-item>
|
||||
<p>Automatically generate constants for command and option names.</p>
|
||||
|
@ -160,7 +160,7 @@ storageDriverPosixFileWrite(StorageDriverPosixFileWrite *this, const Buffer *buf
|
||||
|
||||
// Write the data
|
||||
if (write(this->handle, bufPtr(buffer), bufUsed(buffer)) != (ssize_t)bufUsed(buffer))
|
||||
THROW_SYS_ERROR_FMT(FileWriteError, "unable to write '%s'", strPtr(this->name));
|
||||
THROW_SYS_ERROR_FMT(FileWriteError, "unable to write '%s'", strPtr(this->nameTmp));
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
}
|
||||
@ -182,10 +182,10 @@ storageDriverPosixFileWriteClose(StorageDriverPosixFileWrite *this)
|
||||
{
|
||||
// Sync the file
|
||||
if (this->syncFile)
|
||||
storageDriverPosixFileSync(this->handle, this->name, true, false);
|
||||
storageDriverPosixFileSync(this->handle, this->nameTmp, true, false);
|
||||
|
||||
// Close the file
|
||||
storageDriverPosixFileClose(this->handle, this->name, true);
|
||||
storageDriverPosixFileClose(this->handle, this->nameTmp, true);
|
||||
|
||||
// Rename from temp file
|
||||
if (this->atomic)
|
||||
|
@ -840,17 +840,17 @@ testRun(void)
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileWrite(storageFileWriteFileDriver(file), buffer), FileWriteError,
|
||||
"unable to write '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
"unable to write '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileWriteClose(storageFileWriteFileDriver(file)), FileSyncError,
|
||||
"unable to sync '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
"unable to sync '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Disable file sync so the close can be reached
|
||||
((StorageDriverPosixFileWrite *)file->driver)->syncFile = false;
|
||||
|
||||
TEST_ERROR_FMT(
|
||||
storageDriverPosixFileWriteClose(storageFileWriteFileDriver(file)), FileCloseError,
|
||||
"unable to close '%s': [9] Bad file descriptor", strPtr(fileName));
|
||||
"unable to close '%s.pgbackrest.tmp': [9] Bad file descriptor", strPtr(fileName));
|
||||
|
||||
// Set file handle to -1 so the close on free with not fail
|
||||
((StorageDriverPosixFileWrite *)file->driver)->handle = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user