do not test arrays against NULL
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
@@ -780,7 +780,7 @@ iscsi_login_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
||||
}
|
||||
|
||||
/* optional alias */
|
||||
if (iscsi->alias) {
|
||||
if (iscsi->alias[0]) {
|
||||
if (iscsi_login_add_alias(iscsi, pdu) != 0) {
|
||||
iscsi_free_pdu(iscsi, pdu);
|
||||
return -1;
|
||||
@@ -1079,7 +1079,7 @@ iscsi_process_login_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
|
||||
size -= len + 1;
|
||||
}
|
||||
|
||||
if (status == SCSI_STATUS_REDIRECT && iscsi->target_address) {
|
||||
if (status == SCSI_STATUS_REDIRECT && iscsi->target_address[0]) {
|
||||
ISCSI_LOG(iscsi, 2, "target requests redirect to %s",iscsi->target_address);
|
||||
pdu->callback(iscsi, SCSI_STATUS_REDIRECT, NULL,
|
||||
pdu->private_data);
|
||||
|
||||
@@ -326,7 +326,7 @@ int main(int argc, char *argv[])
|
||||
iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL);
|
||||
iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
|
||||
|
||||
if (iscsi_url->user != NULL) {
|
||||
if (iscsi_url->user[0]) {
|
||||
if (iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd) != 0) {
|
||||
fprintf(stderr, "Failed to set initiator username and password\n");
|
||||
exit(10);
|
||||
|
||||
@@ -425,7 +425,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
iscsi_set_session_type(iscsi, ISCSI_SESSION_DISCOVERY);
|
||||
|
||||
if (iscsi_url->user != NULL) {
|
||||
if (iscsi_url->user[0]) {
|
||||
state.username = iscsi_url->user;
|
||||
state.password = iscsi_url->passwd;
|
||||
if (iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd) != 0) {
|
||||
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||
iscsi_set_session_type(iscsi, ISCSI_SESSION_NORMAL);
|
||||
iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
|
||||
|
||||
if (iscsi_url->user != NULL) {
|
||||
if (iscsi_url->user[0]) {
|
||||
if (iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd) != 0) {
|
||||
fprintf(stderr, "Failed to set initiator username and password\n");
|
||||
exit(10);
|
||||
|
||||
Reference in New Issue
Block a user