1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 00:58:48 -05:00

ssh: fix Condition '!status' is always true

in the same sftp_done function in both SSH backends. Simplify them
somewhat.

Pointed out by Codacy.

Closes #3628
This commit is contained in:
Daniel Stenberg 2019-02-28 15:35:58 +01:00
parent 64d598d91d
commit 14c95f8101
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 6 additions and 14 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2017 - 2018 Red Hat, Inc. * Copyright (C) 2017 - 2019 Red Hat, Inc.
* *
* Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek, * Authors: Nikos Mavrogiannopoulos, Tomas Mraz, Stanislav Zidek,
* Robert Kolcun, Andreas Schneider * Robert Kolcun, Andreas Schneider
@ -2398,14 +2398,10 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status,
/* Post quote commands are executed after the SFTP_CLOSE state to avoid /* Post quote commands are executed after the SFTP_CLOSE state to avoid
errors that could happen due to open file handles during POSTQUOTE errors that could happen due to open file handles during POSTQUOTE
operation */ operation */
if(!status && !premature && conn->data->set.postquote && if(!premature && conn->data->set.postquote && !conn->bits.retry)
!conn->bits.retry) {
sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT; sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
} }
else
state(conn, SSH_SFTP_CLOSE);
}
return myssh_done(conn, status); return myssh_done(conn, status);
} }

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -3222,14 +3222,10 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status,
/* Post quote commands are executed after the SFTP_CLOSE state to avoid /* Post quote commands are executed after the SFTP_CLOSE state to avoid
errors that could happen due to open file handles during POSTQUOTE errors that could happen due to open file handles during POSTQUOTE
operation */ operation */
if(!status && !premature && conn->data->set.postquote && if(!premature && conn->data->set.postquote && !conn->bits.retry)
!conn->bits.retry) {
sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT; sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
} }
else
state(conn, SSH_SFTP_CLOSE);
}
return ssh_done(conn, status); return ssh_done(conn, status);
} }