forked from vitalif/vitastor
Use qdict_get_try_int because qdict_get_int may segfault on a missing key
parent
9ffdeef93b
commit
0bd3a94efd
|
@ -251,19 +251,19 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
|
||||||
}
|
}
|
||||||
if (!client->size)
|
if (!client->size)
|
||||||
{
|
{
|
||||||
client->size = qdict_get_int(options, "size");
|
client->size = qdict_get_try_int(options, "size", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client->watch = NULL;
|
client->watch = NULL;
|
||||||
client->inode = qdict_get_int(options, "inode");
|
client->inode = qdict_get_try_int(options, "inode", 0);
|
||||||
client->pool = qdict_get_int(options, "pool");
|
client->pool = qdict_get_try_int(options, "pool", 0);
|
||||||
if (client->pool)
|
if (client->pool)
|
||||||
{
|
{
|
||||||
client->inode = (client->inode & ((1l << (64-POOL_ID_BITS)) - 1)) | (client->pool << (64-POOL_ID_BITS));
|
client->inode = (client->inode & ((1l << (64-POOL_ID_BITS)) - 1)) | (client->pool << (64-POOL_ID_BITS));
|
||||||
}
|
}
|
||||||
client->size = qdict_get_int(options, "size");
|
client->size = qdict_get_try_int(options, "size", 0);
|
||||||
}
|
}
|
||||||
if (!client->size)
|
if (!client->size)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue