control_fetch返回0字节时,清空string

This commit is contained in:
gb 2022-07-27 14:10:44 +08:00
parent 09eed61f26
commit 01bacfc62e
1 changed files with 2 additions and 2 deletions

View File

@ -474,9 +474,9 @@ std::string hg_scanner_239::control_fetch(int addr, int val, int size)
data.resize(size + 2);
bzero(&data[0], size + 2);
ret = io_->read_bulk(&data[0], &l);
if (ret)
if (ret || l == 0)
{
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk = %s\n", addr, val, hg_scanner_err_name(ret));
VLOG_MINI_4(LOG_LEVEL_DEBUG_INFO, "control_fetch(%d, %d) - read_bulk %d byte(s) = %s\n", addr, val, l, hg_scanner_err_name(ret));
data.clear();
}
}