4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-28 07:07:07 +08:00

fix tar -xzvf symbol link (#8034)

This commit is contained in:
xiao-mang 2023-09-14 11:29:03 +08:00 committed by GitHub
parent 3e3cf91b77
commit 12592458b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1283,7 +1283,7 @@ int dfs_file_symlink(const char *target, const char *linkpath)
{ {
if (dentry->mnt->fs_ops->symlink) if (dentry->mnt->fs_ops->symlink)
{ {
char *path = dfs_normalize_path(NULL, target); char *path = dfs_normalize_path(parent, target);
if (path) if (path)
{ {
char *tmp = dfs_nolink_path(&mnt, path, 0); char *tmp = dfs_nolink_path(&mnt, path, 0);
@ -1297,8 +1297,6 @@ int dfs_file_symlink(const char *target, const char *linkpath)
tmp = path; tmp = path;
} }
if (dfs_file_access(path, O_RDONLY) == 0)
{
ret = rt_strncmp(parent, path, strlen(parent)); ret = rt_strncmp(parent, path, strlen(parent));
if (ret == 0) if (ret == 0)
{ {
@ -1313,11 +1311,6 @@ int dfs_file_symlink(const char *target, const char *linkpath)
{ {
ret = mnt->fs_ops->symlink(dentry, tmp, index + 1); ret = mnt->fs_ops->symlink(dentry, tmp, index + 1);
} }
}
else
{
ret = -ENOENT;
}
rt_free(path); rt_free(path);
} }