Use qdict_get_try_int because qdict_get_int may segfault on a missing key

master
Vitaliy Filippov 2021-12-03 00:22:03 +03:00
parent 9ffdeef93b
commit 0bd3a94efd
1 changed files with 4 additions and 4 deletions

View File

@ -251,19 +251,19 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
}
if (!client->size)
{
client->size = qdict_get_int(options, "size");
client->size = qdict_get_try_int(options, "size", 0);
}
}
else
{
client->watch = NULL;
client->inode = qdict_get_int(options, "inode");
client->pool = qdict_get_int(options, "pool");
client->inode = qdict_get_try_int(options, "inode", 0);
client->pool = qdict_get_try_int(options, "pool", 0);
if (client->pool)
{
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)
{