Commit 88fbd37f authored by Vitaly Ostrosablin's avatar Vitaly Ostrosablin Committed by Andrei Vagin

criu: Don't fail if ghost file has no parent dirs.

Due to way CRIU handles paths (as relative to workdir), there's a case,
where migration would fail. Simple example is a ghost file in filesystem
root (with root being cwd). For example, "/unlinked" becomes "unlinked".
And original code piece scans path for other slashes, which would be
missing in this case. But it's still a perfectly valid case, and there's
no need to fail. So if there's no parent dir - we just don't need to
create one and we can just return 0 here instead of failing.
Signed-off-by: 's avatarVitaly Ostrosablin <vostrosablin@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 8720f1da
...@@ -1474,10 +1474,8 @@ static int make_parent_dirs_if_need(int mntns_root, char *path) ...@@ -1474,10 +1474,8 @@ static int make_parent_dirs_if_need(int mntns_root, char *path)
struct stat st; struct stat st;
p = last_delim = strrchr(path, '/'); p = last_delim = strrchr(path, '/');
if (!p) { if (!p)
pr_err("Path %s has no parent dir\n", path); return 0;
return -1;
}
*p = '\0'; *p = '\0';
if (fstatat(mntns_root, path, &st, AT_EMPTY_PATH) == 0) if (fstatat(mntns_root, path, &st, AT_EMPTY_PATH) == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment