mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +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:
parent
1fd8845c7f
commit
e280ed9098
@ -193,7 +193,7 @@ storageReadSftpClose(THIS_VOID)
|
||||
|
||||
if (this->sftpHandle != NULL)
|
||||
{
|
||||
int rc = 0;
|
||||
int rc;
|
||||
Wait *const wait = waitNew(this->timeout);
|
||||
|
||||
// Close the file
|
||||
@ -205,7 +205,7 @@ storageReadSftpClose(THIS_VOID)
|
||||
|
||||
waitFree(wait);
|
||||
|
||||
if (rc)
|
||||
if (rc != 0)
|
||||
{
|
||||
THROW_FMT(
|
||||
FileCloseError,
|
||||
|
@ -189,7 +189,7 @@ storageWriteSftpUnlinkExisting(THIS_VOID)
|
||||
|
||||
waitFree(wait);
|
||||
|
||||
if (rc)
|
||||
if (rc != 0)
|
||||
{
|
||||
storageSftpEvalLibSsh2Error(
|
||||
rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError,
|
||||
@ -227,7 +227,7 @@ storageWriteSftpRename(THIS_VOID)
|
||||
|
||||
waitFree(wait);
|
||||
|
||||
if (rc)
|
||||
if (rc != 0)
|
||||
{
|
||||
storageSftpEvalLibSsh2Error(
|
||||
rc, libssh2_sftp_last_error(this->sftpSession), &FileRemoveError,
|
||||
@ -271,7 +271,7 @@ storageWriteSftpClose(THIS_VOID)
|
||||
|
||||
waitFree(wait);
|
||||
|
||||
if (rc)
|
||||
if (rc != 0)
|
||||
THROW_FMT(FileSyncError, STORAGE_ERROR_WRITE_SYNC, strZ(this->nameTmp));
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ storageWriteSftpClose(THIS_VOID)
|
||||
|
||||
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
|
||||
if (rc == LIBSSH2_ERROR_SFTP_PROTOCOL && libssh2_sftp_last_error(this->sftpSession) == LIBSSH2_FX_FAILURE)
|
||||
|
@ -424,7 +424,7 @@ libssh2_sftp_symlink_ex(
|
||||
}
|
||||
MEM_CONTEXT_TEMP_END();
|
||||
|
||||
int rc = 0;
|
||||
int rc;
|
||||
|
||||
switch (link_type)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user