Skip to content

Commit be3b49c

Browse files
committed
Fix wait_cnt scope issue
wait_cnt always 0 if defined in while loop. Move the definition out of loop scope. Signed-off-by: Yadong Qi <yadong.qi@intel.com>
1 parent 56bdd84 commit be3b49c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/guest/vm_builder_qemu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ static bool SetupHugePages(const std::string &mem_size) {
190190
WriteSysFile(kSys2MNrHugePages, std::to_string(required_hp));
191191

192192
/* check nr huge pages */
193+
int wait_cnt = 0;
193194
while (nr_hp != required_hp) {
194-
int wait_cnt = 0;
195195
nr_hp = ReadSysFile(kSys2MNrHugePages, std::ios_base::dec);
196196
if (wait_cnt < 200) {
197197
usleep(10000);

0 commit comments

Comments
 (0)