[CRIU] [PATCH 1/5] mount: Delete slash handle from binfmt_misc
Kirill Tkhai
ktkhai at virtuozzo.com
Sat Jul 15 18:25:04 MSK 2017
Review shown, that mounts without slash at end are
not impossible in criu. So, delete this workaround.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/mount.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/criu/mount.c b/criu/mount.c
index 83915b7b2..f258caaf5 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1194,7 +1194,6 @@ int open_mountpoint(struct mount_info *pm)
static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsname, const char *path, unsigned int s_dev)
{
struct mount_info *mi, *t, *parent;
- bool add_slash = false;
int len;
if (!root->nsid) {
@@ -1210,25 +1209,20 @@ static __maybe_unused int add_cr_time_mount(struct mount_info *root, char *fsnam
}
}
- mi = mnt_entry_alloc();
- if (!mi)
- return -1;
-
len = strlen(root->mountpoint);
- /* It may be "./" or "./path/to/dir" */
- if (root->mountpoint[len - 1] != '/') {
- add_slash = true;
- len++;
+ if (root->mountpoint[len-1] != '/') {
+ pr_err("Wrong root: %s\n", root->mountpoint);
+ return -1;
}
+ mi = mnt_entry_alloc();
+ if (!mi)
+ return -1;
mi->mountpoint = xmalloc(len + strlen(path) + 1);
if (!mi->mountpoint)
return -1;
mi->ns_mountpoint = mi->mountpoint;
- if (!add_slash)
- sprintf(mi->mountpoint, "%s%s", root->mountpoint, path);
- else
- sprintf(mi->mountpoint, "%s/%s", root->mountpoint, path);
+ sprintf(mi->mountpoint, "%s%s", root->mountpoint, path);
mi->mnt_id = CRTIME_MNT_ID;
mi->flags = mi->sb_flags = 0;
mi->root = xstrdup("/");
More information about the CRIU
mailing list