diff --git a/cr-show.c b/cr-show.c index be76db74d..7a27bb7be 100644 --- a/cr-show.c +++ b/cr-show.c @@ -557,7 +557,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) * time here, but this saves us from code duplication. */ lseek(cr_fdset->desc[CR_FD_PSTREE].fd, MAGIC_OFFSET, SEEK_SET); - show_pstree(cr_fdset->desc[CR_FD_PSTREE].name, + show_pstree(cr_fdset->desc[CR_FD_PSTREE].path, cr_fdset->desc[CR_FD_PSTREE].fd, true); @@ -575,7 +575,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) goto out; lseek(cr_fdset->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET); - show_core(cr_fdset->desc[CR_FD_CORE].name, + show_core(cr_fdset->desc[CR_FD_CORE].path, cr_fdset->desc[CR_FD_CORE].fd, true, opts->show_pages_content); @@ -601,7 +601,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) pr_info("----------------------------------------\n"); lseek(cr_fdset_th->desc[CR_FD_CORE].fd, MAGIC_OFFSET, SEEK_SET); - show_core(cr_fdset_th->desc[CR_FD_CORE].name, + show_core(cr_fdset_th->desc[CR_FD_CORE].path, cr_fdset_th->desc[CR_FD_CORE].fd, false, opts->show_pages_content); @@ -612,16 +612,16 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts) } } - show_pipes(cr_fdset->desc[CR_FD_PIPES].name, + show_pipes(cr_fdset->desc[CR_FD_PIPES].path, cr_fdset->desc[CR_FD_PIPES].fd, true); - show_files(cr_fdset->desc[CR_FD_FDINFO].name, + show_files(cr_fdset->desc[CR_FD_FDINFO].path, cr_fdset->desc[CR_FD_FDINFO].fd, true); - show_shmem(cr_fdset->desc[CR_FD_SHMEM].name, + show_shmem(cr_fdset->desc[CR_FD_SHMEM].path, cr_fdset->desc[CR_FD_SHMEM].fd, true); - show_sigacts(cr_fdset->desc[CR_FD_SIGACT].name, + show_sigacts(cr_fdset->desc[CR_FD_SIGACT].path, cr_fdset->desc[CR_FD_SIGACT].fd, true); close_cr_fdset(cr_fdset); diff --git a/crtools.c b/crtools.c index 5de175d59..3a9582e79 100644 --- a/crtools.c +++ b/crtools.c @@ -100,8 +100,8 @@ struct cr_fdset *alloc_cr_fdset(pid_t pid) for (i = 0; i < CR_FD_MAX; i++) { cr_fdset->desc[i].tmpl = &fdset_template[i]; - ret = get_image_path(cr_fdset->desc[i].name, - sizeof(cr_fdset->desc[i].name), + ret = get_image_path(cr_fdset->desc[i].path, + sizeof(cr_fdset->desc[i].path), cr_fdset->desc[i].tmpl->fmt, pid); if (ret) { @@ -131,26 +131,26 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset, if (!(use_mask & CR_FD_DESC_USE(i))) continue; - ret = unlink(cr_fdset->desc[i].name); + ret = unlink(cr_fdset->desc[i].path); if (ret && errno != ENOENT) { pr_perror("Unable to unlink %s (%s)\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, strerror(errno)); goto err; } else ret = -1; - cr_fdset->desc[i].fd = open(cr_fdset->desc[i].name, + cr_fdset->desc[i].fd = open(cr_fdset->desc[i].path, O_RDWR | O_CREAT | O_EXCL, CR_FD_PERM); if (cr_fdset->desc[i].fd < 0) { pr_perror("Unable to open %s (%s)\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, strerror(errno)); goto err; } pr_debug("Opened %s with %d\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, cr_fdset->desc[i].fd); magic = cr_fdset->desc[i].tmpl->magic; @@ -177,23 +177,23 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset, if (!(use_mask & CR_FD_DESC_USE(i))) continue; - cr_fdset->desc[i].fd = open(cr_fdset->desc[i].name, + cr_fdset->desc[i].fd = open(cr_fdset->desc[i].path, O_RDWR, CR_FD_PERM); if (cr_fdset->desc[i].fd < 0) { pr_perror("Unable to open %s (%s)\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, strerror(errno)); goto err; } pr_debug("Opened %s with %d\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, cr_fdset->desc[i].fd); read_ptr_safe(cr_fdset->desc[i].fd, &magic, err); if (magic != cr_fdset->desc[i].tmpl->magic) { pr_err("Magic doesn't match for %s\n", - cr_fdset->desc[i].name); + cr_fdset->desc[i].path); goto err; } @@ -216,7 +216,7 @@ void close_cr_fdset(struct cr_fdset *cr_fdset) if (cr_fdset->desc[i].fd >= 0) { pr_debug("Closed %s with %d\n", - cr_fdset->desc[i].name, + cr_fdset->desc[i].path, cr_fdset->desc[i].fd); close(cr_fdset->desc[i].fd); cr_fdset->desc[i].fd = -1; diff --git a/include/crtools.h b/include/crtools.h index d144386c6..ae082fb3a 100644 --- a/include/crtools.h +++ b/include/crtools.h @@ -70,7 +70,7 @@ extern char image_dir[]; /* file descriptors */ struct cr_fd_desc { struct cr_fd_desc_tmpl *tmpl; /* template we refer to */ - char name[64]; /* the name, based on pid */ + char path[PATH_MAX]; /* the path, based on pid */ int fd; /* descriptor for open/close */ }; diff --git a/parasite-syscall.c b/parasite-syscall.c index c9aafe85c..0847c5eee 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -350,7 +350,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f pr_info("Dumping sigactions (pid: %d)\n", ctl->pid); pr_info("----------------------------------------\n"); - path_len = strlen(cr_fdset->desc[CR_FD_SIGACT].name); + path_len = strlen(cr_fdset->desc[CR_FD_SIGACT].path); if (path_len > sizeof(parasite_sigacts.open_path)) { pr_panic("Dumping sigactions path is too long (%d while %d allowed)\n", @@ -364,7 +364,7 @@ int parasite_dump_sigacts_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f } strncpy(parasite_sigacts.open_path, - cr_fdset->desc[CR_FD_SIGACT].name, + cr_fdset->desc[CR_FD_SIGACT].path, sizeof(parasite_sigacts.open_path)); parasite_sigacts.open_flags = O_WRONLY; @@ -402,8 +402,8 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a pr_info("Dumping pages (type: %d pid: %d)\n", fd_type, ctl->pid); pr_info("----------------------------------------\n"); - path_len = strlen(cr_fdset->desc[fd_type].name); - pr_info("Dumping pages %s\n", cr_fdset->desc[fd_type].name); + path_len = strlen(cr_fdset->desc[fd_type].path); + pr_info("Dumping pages %s\n", cr_fdset->desc[fd_type].path); if (path_len > sizeof(parasite_dumppages.open_path)) { pr_panic("Dumping pages path is too long (%d while %d allowed)\n", @@ -423,7 +423,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a fsync(cr_fdset->desc[fd_type].fd); strncpy(parasite_dumppages.open_path, - cr_fdset->desc[fd_type].name, + cr_fdset->desc[fd_type].path, sizeof(parasite_dumppages.open_path)); parasite_dumppages.open_flags = O_WRONLY;