2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-03 15:55:53 +00:00

crtools: Merge fdset free into close

The same as previous patch -- no need in two separate calls.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
Pavel Emelyanov
2012-01-12 15:19:14 +04:00
committed by Cyrill Gorcunov
parent 871b73674d
commit 6b83aef6a1
4 changed files with 1 additions and 17 deletions

View File

@@ -1257,12 +1257,10 @@ int cr_dump_tasks(pid_t pid, struct cr_options *opts)
goto err;
close_cr_fdset(cr_fdset_thread);
free_cr_fdset(&cr_fdset_thread);
}
}
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
if (opts->leader_only)
break;
@@ -1282,10 +1280,7 @@ err:
free_pstree(&pstree_list);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
close_cr_fdset(cr_fdset_thread);
free_cr_fdset(&cr_fdset_thread);
return ret;
}

View File

@@ -513,7 +513,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
show_pstree(cr_fdset->fds[CR_FD_PSTREE]);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
list_for_each_entry(item, &pstree_list, list) {
@@ -547,7 +546,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
pr_info("----------------------------------------\n");
close_cr_fdset(cr_fdset_th);
free_cr_fdset(&cr_fdset_th);
}
}
@@ -562,7 +560,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
show_unixsk(cr_fdset->fds[CR_FD_UNIXSK]);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
if (opts->leader_only)
break;
@@ -571,7 +568,6 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
out:
free_pstree(&pstree_list);
close_cr_fdset(cr_fdset);
free_cr_fdset(&cr_fdset);
return ret;
}

View File

@@ -195,14 +195,8 @@ void close_cr_fdset(struct cr_fdset *cr_fdset)
close(cr_fdset->fds[i]);
cr_fdset->fds[i] = -1;
}
}
void free_cr_fdset(struct cr_fdset **cr_fdset)
{
if (cr_fdset && *cr_fdset) {
free(*cr_fdset);
*cr_fdset = NULL;
}
free(cr_fdset);
}
int get_image_path(char *path, int size, const char *fmt, int pid)

View File

@@ -88,7 +88,6 @@ int convert_to_elf(char *elf_path, int fd_core);
struct cr_fdset *prep_cr_fdset_for_dump(int pid, unsigned long use_mask);
struct cr_fdset *prep_cr_fdset_for_restore(int pid, unsigned long use_mask);
void close_cr_fdset(struct cr_fdset *cr_fdset);
void free_cr_fdset(struct cr_fdset **cr_fdset);
void free_mappings(struct list_head *vma_area_list);