mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virsh: Fix support for 64 migration options
Add ULL suffix to all related operands of << or shift will give
all zeros instead of correct mask.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
(cherry picked from commit 4d28d0931f
)
This commit is contained in:
parent
082deb52ac
commit
58f53d2302
18
tools/vsh.c
18
tools/vsh.c
@ -377,17 +377,17 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
|
|||||||
}
|
}
|
||||||
if (opt->flags & VSH_OFLAG_REQ_OPT) {
|
if (opt->flags & VSH_OFLAG_REQ_OPT) {
|
||||||
if (opt->flags & VSH_OFLAG_REQ)
|
if (opt->flags & VSH_OFLAG_REQ)
|
||||||
*opts_required |= 1 << i;
|
*opts_required |= 1ULL << i;
|
||||||
else
|
else
|
||||||
optional = true;
|
optional = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
*opts_need_arg |= 1 << i;
|
*opts_need_arg |= 1ULL << i;
|
||||||
if (opt->flags & VSH_OFLAG_REQ) {
|
if (opt->flags & VSH_OFLAG_REQ) {
|
||||||
if (optional && opt->type != VSH_OT_ARGV)
|
if (optional && opt->type != VSH_OT_ARGV)
|
||||||
return -1; /* mandatory options must be listed first */
|
return -1; /* mandatory options must be listed first */
|
||||||
*opts_required |= 1 << i;
|
*opts_required |= 1ULL << i;
|
||||||
} else {
|
} else {
|
||||||
optional = true;
|
optional = true;
|
||||||
}
|
}
|
||||||
@ -441,11 +441,11 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((*opts_seen & (1 << i)) && opt->type != VSH_OT_ARGV) {
|
if ((*opts_seen & (1ULL << i)) && opt->type != VSH_OT_ARGV) {
|
||||||
vshError(ctl, _("option --%s already seen"), name);
|
vshError(ctl, _("option --%s already seen"), name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
*opts_seen |= 1 << i;
|
*opts_seen |= 1ULL << i;
|
||||||
*opt_index = i;
|
*opt_index = i;
|
||||||
ret = opt;
|
ret = opt;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -475,8 +475,8 @@ vshCmddefGetData(const vshCmdDef *cmd, uint32_t *opts_need_arg,
|
|||||||
i = ffs(*opts_need_arg) - 1;
|
i = ffs(*opts_need_arg) - 1;
|
||||||
opt = &cmd->opts[i];
|
opt = &cmd->opts[i];
|
||||||
if (opt->type != VSH_OT_ARGV)
|
if (opt->type != VSH_OT_ARGV)
|
||||||
*opts_need_arg &= ~(1 << i);
|
*opts_need_arg &= ~(1ULL << i);
|
||||||
*opts_seen |= 1 << i;
|
*opts_seen |= 1ULL << i;
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint32_t opts_required,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; def->opts[i].name; i++) {
|
for (i = 0; def->opts[i].name; i++) {
|
||||||
if (opts_required & (1 << i)) {
|
if (opts_required & (1ULL << i)) {
|
||||||
const vshCmdOptDef *opt = &def->opts[i];
|
const vshCmdOptDef *opt = &def->opts[i];
|
||||||
|
|
||||||
vshError(ctl,
|
vshError(ctl,
|
||||||
@ -1420,7 +1420,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
|
|||||||
goto syntaxError;
|
goto syntaxError;
|
||||||
}
|
}
|
||||||
if (opt->type != VSH_OT_ARGV)
|
if (opt->type != VSH_OT_ARGV)
|
||||||
opts_need_arg &= ~(1 << opt_index);
|
opts_need_arg &= ~(1ULL << opt_index);
|
||||||
} else {
|
} else {
|
||||||
tkdata = NULL;
|
tkdata = NULL;
|
||||||
if (optstr) {
|
if (optstr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user