提交 d151ea05 编写于 作者: L LiFeng 提交者: lifeng68

driver: make NULL as valid parent ID

Signed-off-by: NLiFeng <lifeng68@huawei.com>
上级 6ce5ee4c
......@@ -48,7 +48,7 @@ static int do_create(const char *id, const char *parent, const struct driver_cre
int devmapper_create_rw(const char *id, const char *parent, const struct graphdriver *driver,
const struct driver_create_opts *create_opts)
{
if (id == NULL || parent == NULL || driver == NULL || create_opts == NULL) {
if (id == NULL || driver == NULL || create_opts == NULL) {
return -1;
}
......@@ -59,7 +59,7 @@ int devmapper_create_rw(const char *id, const char *parent, const struct graphdr
int devmapper_create_ro(const char *id, const char *parent, const struct graphdriver *driver,
const struct driver_create_opts *create_opts)
{
if (id == NULL || parent == NULL || driver == NULL || create_opts == NULL) {
if (id == NULL || driver == NULL || create_opts == NULL) {
return -1;
}
......
......@@ -110,7 +110,7 @@ int graphdriver_create_rw(const char *id, const char *parent, struct driver_crea
return -1;
}
if (id == NULL || parent == NULL || create_opts == NULL) {
if (id == NULL || create_opts == NULL) {
ERROR("Invalid input arguments for driver create");
return -1;
}
......@@ -125,7 +125,7 @@ int graphdriver_create_ro(const char *id, const char *parent, const struct drive
return -1;
}
if (id == NULL || parent == NULL || create_opts == NULL) {
if (id == NULL || create_opts == NULL) {
ERROR("Invalid input arguments for driver create");
return -1;
}
......@@ -296,7 +296,7 @@ int graphdriver_try_repair_lowers(const char *id, const char *parent)
return -1;
}
if (id == NULL || parent == NULL) {
if (id == NULL) {
ERROR("Invalid input arguments for driver repair lower");
return -1;
}
......
......@@ -339,7 +339,7 @@ static int check_parent_valid(const char *parent, const struct graphdriver *driv
int ret = 0;
char *parent_dir = NULL;
if (strcmp(parent, "") != 0) {
if (parent != NULL) {
parent_dir = util_path_join(driver->home, parent);
if (parent_dir == NULL) {
ERROR("Failed to join layer dir:%s", parent);
......@@ -677,7 +677,7 @@ static int mk_sub_directorys(const char *id, const char *parent, const char *lay
goto out;
}
if (strcmp(parent, "") == 0) {
if (parent == NULL) {
if (mk_empty_directory(layer_dir) != 0) {
ret = -1;
goto out;
......@@ -822,7 +822,7 @@ int overlay2_create_rw(const char *id, const char *parent, const struct graphdri
{
int ret = 0;
if (id == NULL || parent == NULL || driver == NULL || create_opts == NULL) {
if (id == NULL || driver == NULL || create_opts == NULL) {
return -1;
}
......@@ -848,7 +848,7 @@ int overlay2_create_ro(const char *id, const char *parent, const struct graphdri
{
int ret = 0;
if (id == NULL || parent == NULL || driver == NULL || create_opts == NULL) {
if (id == NULL || driver == NULL || create_opts == NULL) {
return -1;
}
......@@ -1783,7 +1783,7 @@ int overlay2_repair_lowers(const char *id, const char *parent, const struct grap
char **lowers_arr = NULL;
size_t lowers_size = 0;
if (id == NULL || driver == NULL || parent == NULL) {
if (id == NULL || driver == NULL) {
return -1;
}
......@@ -1810,7 +1810,7 @@ int overlay2_repair_lowers(const char *id, const char *parent, const struct grap
}
}
if (strcmp(parent, "") == 0) {
if (parent == NULL) {
if (mk_empty_directory(layer_dir) != 0) {
ret = -1;
goto out;
......
......@@ -96,7 +96,7 @@ int storage_layer_create(const char *layer_id, const char *parent_id, bool write
struct io_read_wrapper reader = { 0 };
struct layer_opts *opts = NULL;
if (layer_id == NULL || parent_id == NULL || layer_data_path == NULL) {
if (layer_id == NULL || layer_data_path == NULL) {
ERROR("Invalid arguments for put ro layer");
ret = -1;
goto out;
......@@ -197,7 +197,7 @@ int storage_img_create(const char *id, const char *parent_id, const char *metada
int ret = 0;
char *image_id = NULL;
if (id == NULL || parent_id == NULL || metadata == NULL || opts == NULL) {
if (id == NULL || metadata == NULL || opts == NULL) {
ERROR("Invalid arguments for image create");
ret = -1;
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册