diff --git a/block/iscsi.c b/block/iscsi.c index 1fa855acdda3b3957a73345449df9dbf27d07575..3e34b1f3a240493a823a545fc455bd64f32ea975 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1326,7 +1326,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags, goto out; } - if (iscsi_url->user != NULL) { + if (iscsi_url->user[0] != '\0') { ret = iscsi_set_initiator_username_pwd(iscsi, iscsi_url->user, iscsi_url->passwd); if (ret != 0) {