mirror of
https://github.com/curl/curl.git
synced 2026-07-25 14:37:17 +03:00
checksrc: warn for assignments within if() expressions
... they're already frowned upon in our source code style guide, this now enforces the rule harder.
This commit is contained in:
parent
b228d2952b
commit
1c3e8bbfed
86 changed files with 413 additions and 226 deletions
35
lib/ssh.c
35
lib/ssh.c
|
|
@ -782,14 +782,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||
state(conn, SSH_AUTH_DONE);
|
||||
break;
|
||||
}
|
||||
else if((err = libssh2_session_last_errno(sshc->ssh_session)) ==
|
||||
LIBSSH2_ERROR_EAGAIN) {
|
||||
rc = LIBSSH2_ERROR_EAGAIN;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
state(conn, SSH_SESSION_FREE);
|
||||
sshc->actualcode = libssh2_session_error_to_CURLE(err);
|
||||
err = libssh2_session_last_errno(sshc->ssh_session);
|
||||
if(err == LIBSSH2_ERROR_EAGAIN)
|
||||
rc = LIBSSH2_ERROR_EAGAIN;
|
||||
else {
|
||||
state(conn, SSH_SESSION_FREE);
|
||||
sshc->actualcode = libssh2_session_error_to_CURLE(err);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1987,12 +1987,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if((sshc->readdir_filename = malloc(PATH_MAX+1)) == NULL) {
|
||||
sshc->readdir_filename = malloc(PATH_MAX+1);
|
||||
if(!sshc->readdir_filename) {
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||
break;
|
||||
}
|
||||
if((sshc->readdir_longentry = malloc(PATH_MAX+1)) == NULL) {
|
||||
sshc->readdir_longentry = malloc(PATH_MAX+1);
|
||||
if(!sshc->readdir_longentry) {
|
||||
Curl_safefree(sshc->readdir_filename);
|
||||
state(conn, SSH_SFTP_CLOSE);
|
||||
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -2789,13 +2791,16 @@ static int ssh_getsock(struct connectdata *conn,
|
|||
static void ssh_block2waitfor(struct connectdata *conn, bool block)
|
||||
{
|
||||
struct ssh_conn *sshc = &conn->proto.sshc;
|
||||
int dir;
|
||||
if(block && (dir = libssh2_session_block_directions(sshc->ssh_session))) {
|
||||
/* translate the libssh2 define bits into our own bit defines */
|
||||
conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
|
||||
((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
|
||||
int dir = 0;
|
||||
if(block) {
|
||||
dir = libssh2_session_block_directions(sshc->ssh_session);
|
||||
if(dir) {
|
||||
/* translate the libssh2 define bits into our own bit defines */
|
||||
conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
|
||||
((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
|
||||
}
|
||||
}
|
||||
else
|
||||
if(!dir)
|
||||
/* It didn't block or libssh2 didn't reveal in which direction, put back
|
||||
the original set */
|
||||
conn->waitfor = sshc->orig_waitfor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue