mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-26 11:28:28 +00:00
hostfs: Use __getname() in follow_link
Be consistent with all other functions in hostfs and just use __getname(). Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
c278e81b8a
commit
7c9509924c
@ -142,21 +142,19 @@ static char *follow_link(char *link)
|
||||
int len, n;
|
||||
char *name, *resolved, *end;
|
||||
|
||||
len = 64;
|
||||
while (1) {
|
||||
name = __getname();
|
||||
if (!name) {
|
||||
n = -ENOMEM;
|
||||
name = kmalloc(len, GFP_KERNEL);
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
|
||||
n = hostfs_do_readlink(link, name, len);
|
||||
if (n < len)
|
||||
break;
|
||||
len *= 2;
|
||||
kfree(name);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
n = hostfs_do_readlink(link, name, PATH_MAX);
|
||||
if (n < 0)
|
||||
goto out_free;
|
||||
else if (n == PATH_MAX) {
|
||||
n = -E2BIG;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
if (*name == '/')
|
||||
return name;
|
||||
@ -175,13 +173,12 @@ static char *follow_link(char *link)
|
||||
}
|
||||
|
||||
sprintf(resolved, "%s%s", link, name);
|
||||
kfree(name);
|
||||
__putname(name);
|
||||
kfree(link);
|
||||
return resolved;
|
||||
|
||||
out_free:
|
||||
kfree(name);
|
||||
out:
|
||||
__putname(name);
|
||||
return ERR_PTR(n);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user