提交 0ee4415c 编写于 作者: D Daniel Veillard

* src/virsh.c: vshCommandOptInt was broken as it would not

  detect non-int inputs, problem raised by Masayuki Sunou
Daniel
上级 d7b5e2c2
Thu Aug 16 15:24:30 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: vshCommandOptInt was broken as it would not
detect non-int inputs, problem raised by Masayuki Sunou
Wed Aug 15 12:21:13 CEST 2007 Daniel Veillard <veillard@redhat.com> Wed Aug 15 12:21:13 CEST 2007 Daniel Veillard <veillard@redhat.com>
* src/virsh.c: fixed 2 small bugs in setvcpus command, after * src/virsh.c: fixed 2 small bugs in setvcpus command, after
......
...@@ -3699,12 +3699,18 @@ static int ...@@ -3699,12 +3699,18 @@ static int
vshCommandOptInt(vshCmd * cmd, const char *name, int *found) vshCommandOptInt(vshCmd * cmd, const char *name, int *found)
{ {
vshCmdOpt *arg = vshCommandOpt(cmd, name); vshCmdOpt *arg = vshCommandOpt(cmd, name);
int res = 0; int res = 0, num_found = FALSE;
char *end_p = NULL;
if (arg) if ((arg != NULL) && (arg->data != NULL)) {
res = atoi(arg->data); res = strtol(arg->data, &end_p, 10);
if ((arg->data == end_p) || (*end_p!= 0))
num_found = FALSE;
else
num_found = TRUE;
}
if (found) if (found)
*found = arg ? TRUE : FALSE; *found = num_found;
return res; return res;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册