|
@@ -628,7 +628,7 @@ restart:
|
|
|
rc = SSH_OK;
|
|
|
else if(rc == SSH_AUTH_INFO) {
|
|
|
nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session);
|
|
|
- if(nprompts != 0)
|
|
|
+ if(nprompts)
|
|
|
return SSH_ERROR;
|
|
|
|
|
|
sshc->kbd_state = 2;
|
|
@@ -958,7 +958,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
* Get the "home" directory
|
|
|
*/
|
|
|
sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, ".");
|
|
|
- if(sshc->homedir == NULL) {
|
|
|
+ if(!sshc->homedir) {
|
|
|
MOVE_TO_ERROR_STATE(CURLE_COULDNT_CONNECT);
|
|
|
break;
|
|
|
}
|
|
@@ -1033,7 +1033,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
case SSH_SFTP_QUOTE_SETSTAT:
|
|
|
rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2,
|
|
|
sshc->quote_attrs);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
Curl_safefree(sshc->quote_path2);
|
|
|
failf(data, "Attempt to set SFTP stats failed: %s",
|
|
@@ -1052,7 +1052,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
case SSH_SFTP_QUOTE_SYMLINK:
|
|
|
rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2,
|
|
|
sshc->quote_path1);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
Curl_safefree(sshc->quote_path2);
|
|
|
failf(data, "symlink command failed: %s",
|
|
@@ -1068,7 +1068,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
case SSH_SFTP_QUOTE_MKDIR:
|
|
|
rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1,
|
|
|
(mode_t)data->set.new_directory_perms);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
failf(data, "mkdir command failed: %s",
|
|
|
ssh_get_error(sshc->ssh_session));
|
|
@@ -1083,7 +1083,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
case SSH_SFTP_QUOTE_RENAME:
|
|
|
rc = sftp_rename(sshc->sftp_session, sshc->quote_path1,
|
|
|
sshc->quote_path2);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
Curl_safefree(sshc->quote_path2);
|
|
|
failf(data, "rename command failed: %s",
|
|
@@ -1098,7 +1098,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
|
|
|
case SSH_SFTP_QUOTE_RMDIR:
|
|
|
rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
failf(data, "rmdir command failed: %s",
|
|
|
ssh_get_error(sshc->ssh_session));
|
|
@@ -1112,7 +1112,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
|
|
|
case SSH_SFTP_QUOTE_UNLINK:
|
|
|
rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1);
|
|
|
- if(rc != 0 && !sshc->acceptfail) {
|
|
|
+ if(rc && !sshc->acceptfail) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
failf(data, "rm command failed: %s",
|
|
|
ssh_get_error(sshc->ssh_session));
|
|
@@ -1187,7 +1187,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
sftp_attributes attrs;
|
|
|
|
|
|
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
|
|
- if(attrs != 0) {
|
|
|
+ if(attrs) {
|
|
|
data->info.filetime = attrs->mtime;
|
|
|
sftp_attributes_free(attrs);
|
|
|
}
|
|
@@ -1211,12 +1211,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
{
|
|
|
int flags;
|
|
|
|
|
|
- if(data->state.resume_from != 0) {
|
|
|
+ if(data->state.resume_from) {
|
|
|
sftp_attributes attrs;
|
|
|
|
|
|
if(data->state.resume_from < 0) {
|
|
|
attrs = sftp_stat(sshc->sftp_session, protop->path);
|
|
|
- if(attrs != 0) {
|
|
|
+ if(attrs) {
|
|
|
curl_off_t size = attrs->size;
|
|
|
if(size < 0) {
|
|
|
failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
|
|
@@ -1317,7 +1317,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
}
|
|
|
|
|
|
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
|
|
- if(rc != 0) {
|
|
|
+ if(rc) {
|
|
|
MOVE_TO_SFTP_CLOSE_STATE();
|
|
|
break;
|
|
|
}
|
|
@@ -1433,7 +1433,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
char *tmpLine;
|
|
|
|
|
|
tmpLine = aprintf("%s\n", sshc->readdir_filename);
|
|
|
- if(tmpLine == NULL) {
|
|
|
+ if(!tmpLine) {
|
|
|
state(data, SSH_SFTP_CLOSE);
|
|
|
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
|
|
break;
|
|
@@ -1472,7 +1472,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
sshc->readdir_linkPath = aprintf("%s%s", protop->path,
|
|
|
sshc->readdir_filename);
|
|
|
|
|
|
- if(sshc->readdir_linkPath == NULL) {
|
|
|
+ if(!sshc->readdir_linkPath) {
|
|
|
state(data, SSH_SFTP_CLOSE);
|
|
|
sshc->actualcode = CURLE_OUT_OF_MEMORY;
|
|
|
break;
|
|
@@ -1510,10 +1510,10 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- if(sshc->readdir_link_attrs->name == NULL) {
|
|
|
+ if(!sshc->readdir_link_attrs->name) {
|
|
|
sshc->readdir_tmp = sftp_readlink(sshc->sftp_session,
|
|
|
sshc->readdir_linkPath);
|
|
|
- if(sshc->readdir_filename == NULL)
|
|
|
+ if(!sshc->readdir_filename)
|
|
|
sshc->readdir_len = 0;
|
|
|
else
|
|
|
sshc->readdir_len = strlen(sshc->readdir_tmp);
|
|
@@ -1679,7 +1679,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
}
|
|
|
|
|
|
rc = sftp_seek64(sshc->sftp_file, from);
|
|
|
- if(rc != 0) {
|
|
|
+ if(rc) {
|
|
|
MOVE_TO_SFTP_CLOSE_STATE();
|
|
|
break;
|
|
|
}
|
|
@@ -1718,7 +1718,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
|
|
|
size - data->state.resume_from);
|
|
|
|
|
|
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
|
|
|
- if(rc != 0) {
|
|
|
+ if(rc) {
|
|
|
MOVE_TO_SFTP_CLOSE_STATE();
|
|
|
break;
|
|
|
}
|
|
@@ -2187,7 +2187,7 @@ static CURLcode myssh_connect(struct Curl_easy *data, bool *done)
|
|
|
ssh = &conn->proto.sshc;
|
|
|
|
|
|
ssh->ssh_session = ssh_new();
|
|
|
- if(ssh->ssh_session == NULL) {
|
|
|
+ if(!ssh->ssh_session) {
|
|
|
failf(data, "Failure initialising ssh session");
|
|
|
return CURLE_FAILED_INIT;
|
|
|
}
|
|
@@ -2685,7 +2685,7 @@ static void sftp_quote(struct Curl_easy *data)
|
|
|
* command with a space so we can check for it unconditionally
|
|
|
*/
|
|
|
cp = strchr(cmd, ' ');
|
|
|
- if(cp == NULL) {
|
|
|
+ if(!cp) {
|
|
|
failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
|
|
|
state(data, SSH_SFTP_CLOSE);
|
|
|
sshc->nextstate = SSH_NO_STATE;
|
|
@@ -2834,7 +2834,7 @@ static void sftp_quote_stat(struct Curl_easy *data)
|
|
|
if(sshc->quote_attrs)
|
|
|
sftp_attributes_free(sshc->quote_attrs);
|
|
|
sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2);
|
|
|
- if(sshc->quote_attrs == NULL) {
|
|
|
+ if(!sshc->quote_attrs) {
|
|
|
Curl_safefree(sshc->quote_path1);
|
|
|
Curl_safefree(sshc->quote_path2);
|
|
|
failf(data, "Attempt to get SFTP stats failed: %d",
|