mirror of
https://github.com/schoebel/mars
synced 2025-04-01 00:06:32 +00:00
infra: only warn on bad readlink
This commit is contained in:
parent
b3fb3d3731
commit
780cb41f1f
@ -739,11 +739,23 @@ char *mars_readlink(const char *newpath)
|
||||
#else
|
||||
inode = path.dentry->d_inode;
|
||||
#endif
|
||||
if (unlikely(!inode || !S_ISLNK(inode->i_mode))) {
|
||||
if (unlikely(!inode)) {
|
||||
MARS_ERR("link '%s' has invalid inode\n", newpath);
|
||||
status = -EINVAL;
|
||||
goto done_put;
|
||||
}
|
||||
if (S_ISDIR(inode->i_mode)) {
|
||||
/* fail silently: this can happen during
|
||||
* deletions of directories
|
||||
*/
|
||||
status = -EINVAL;
|
||||
goto done_put;
|
||||
}
|
||||
if (!S_ISLNK(inode->i_mode)) {
|
||||
MARS_WRN("'%s' is no symlink\n", newpath);
|
||||
status = -EINVAL;
|
||||
goto done_put;
|
||||
}
|
||||
|
||||
len = i_size_read(inode);
|
||||
if (unlikely(len <= 0 || len > PAGE_SIZE)) {
|
||||
|
Loading…
Reference in New Issue
Block a user