[CRIU] [PATCH 2/3] files-reg: Delete ghost file numeric index
Kirill Tkhai
ktkhai at virtuozzo.com
Mon Feb 8 05:03:33 PST 2016
Since ghost_files content is not available for parent
tasks, leave ghost_file names unchanged.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
files-reg.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/files-reg.c b/files-reg.c
index 46bf9f9..1521ffe 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -169,8 +169,8 @@ static int ghost_apply_metadata(const char *path, GhostFileEntry *gfe)
static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_img *img)
{
- int ret, len, root_len, try = 0;
char path[PATH_MAX];
+ int ret, root_len;
char *msg;
root_len = ret = rst_get_mnt_root(gf->remap.rmnt_id, path, sizeof(path));
@@ -179,7 +179,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
goto err;
}
- len = snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath) + ret;
+ snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath);
ret = -1;
again:
if (S_ISFIFO(gfe->mode)) {
@@ -209,22 +209,11 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
pr_err("trim failed: @%s@\n", path);
goto err;
}
- len = strlen(path);
goto again;
}
- /* Use numeric suffix, if a namesake already exists */
- if (errno != EEXIST) {
- pr_perror("%s", msg);
- goto err;
- }
-
- if (++try == INT_MAX) {
- pr_err("Can't find available file name\n");
- goto err;
- }
- sprintf(path + len, ".%x", try);
- goto again;
+ pr_perror("%s", msg);
+ goto err;
}
strcpy(gf->remap.rpath, path + root_len + 1);
More information about the CRIU
mailing list