1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-04-15 11:36:40 +02:00

Make result code handling in storage/sftp more consistent.

Initializers are useless since rc is always set later. Make rc checks consistent with the rest of the module.
This commit is contained in:
David Steele 2023-07-06 08:58:16 +02:00
parent 1fd8845c7f
commit e280ed9098
3 changed files with 7 additions and 7 deletions

View File

@ -193,7 +193,7 @@ storageReadSftpClose(THIS_VOID)
if (this->sftpHandle != NULL) if (this->sftpHandle != NULL)
{ {
int rc = 0; int rc;
Wait *const wait = waitNew(this->timeout); Wait *const wait = waitNew(this->timeout);
// Close the file // Close the file
@ -205,7 +205,7 @@ storageReadSftpClose(THIS_VOID)
waitFree(wait); waitFree(wait);
if (rc) if (rc != 0)
{ {
THROW_FMT( THROW_FMT(
FileCloseError, FileCloseError,

View File

@ -189,7 +189,7 @@ storageWriteSftpUnlinkExisting(THIS_VOID)
waitFree(wait); waitFree(wait);
if (rc) if (rc != 0)
{ {
storageSftpEvalLibSsh2Error( storageSftpEvalLibSsh2Error(
rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError, rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError,
@ -227,7 +227,7 @@ storageWriteSftpRename(THIS_VOID)
waitFree(wait); waitFree(wait);
if (rc) if (rc != 0)
{ {
storageSftpEvalLibSsh2Error( storageSftpEvalLibSsh2Error(
rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError, rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError,
@ -271,7 +271,7 @@ storageWriteSftpClose(THIS_VOID)
waitFree(wait); waitFree(wait);
if (rc) if (rc != 0)
THROW_FMT(FileSyncError, STORAGE_ERROR_WRITE_SYNC, strZ(this->nameTmp)); THROW_FMT(FileSyncError, STORAGE_ERROR_WRITE_SYNC, strZ(this->nameTmp));
} }
@ -313,7 +313,7 @@ storageWriteSftpClose(THIS_VOID)
waitFree(wait); waitFree(wait);
if (rc) if (rc != 0)
{ {
// Some/most sftp servers will not rename over an existing file, in testing this returned LIBSSH2_FX_FAILURE // Some/most sftp servers will not rename over an existing file, in testing this returned LIBSSH2_FX_FAILURE
if (rc == LIBSSH2_ERROR_SFTP_PROTOCOL && libssh2_sftp_last_error(this->sftpSession) == LIBSSH2_FX_FAILURE) if (rc == LIBSSH2_ERROR_SFTP_PROTOCOL && libssh2_sftp_last_error(this->sftpSession) == LIBSSH2_FX_FAILURE)

View File

@ -424,7 +424,7 @@ libssh2_sftp_symlink_ex(
} }
MEM_CONTEXT_TEMP_END(); MEM_CONTEXT_TEMP_END();
int rc = 0; int rc;
switch (link_type) switch (link_type)
{ {