提交 a84d47a4 编写于 作者: G gaohuatao

fix code review format bug

Signed-off-by: Ngaohuatao <gaohuatao@huawei.com>
上级 d3095397
......@@ -3128,6 +3128,12 @@ struct status *device_set_status(struct device_set *devset)
if (pool_status(devset, &total_size_in_sectors, &transaction_id, &data_used, &data_total, &metadata_used,
&metadata_total) == 0) {
if (data_total == 0) {
ERROR("devmapper: device data total value is zero");
free_devmapper_status(st);
st = NULL;
goto free_out;
}
uint64_t block_size_in_sectors = total_size_in_sectors / data_total;
st->data.used = data_used * block_size_in_sectors * 512;
st->data.total = data_total * block_size_in_sectors * 512;
......@@ -3152,6 +3158,8 @@ struct status *device_set_status(struct device_set *devset)
msg_len = snprintf(msg, PATH_MAX, "system semaphore nums has attached limit: %d", sem_usz);
if (msg_len < 0 || msg_len >= PATH_MAX) {
ERROR("Cannot get semaphore err msg");
free_devmapper_status(st);
st = NULL;
goto free_out;
}
st->sem_msg = util_strdup_s(msg);
......
......@@ -205,7 +205,7 @@ char *devmapper_mount_layer(const char *id, const struct graphdriver *driver,
goto out;
}
if (util_mkdir_p(rootfs, 0755) != 0 || !util_dir_exists(rootfs)) {
if (util_mkdir_p(rootfs, DEFAULT_SECURE_DIRECTORY_MODE) != 0 || !util_dir_exists(rootfs)) {
ERROR("Unable to create devmapper rootfs directory %s.", rootfs);
ret = -1;
if (unmount_device(id, mnt_point_dir, driver->devset) != 0) {
......
......@@ -394,7 +394,7 @@ static int mk_diff_directory(const char *layer_dir)
goto out;
}
if (util_mkdir_p(diff_dir, 0755) != 0) {
if (util_mkdir_p(diff_dir, DEFAULT_SECURE_DIRECTORY_MODE) != 0) {
ERROR("Unable to create layer diff directory %s.", diff_dir);
ret = -1;
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册