Fix short symlinks
This commit is contained in:
parent
7a6e93788c
commit
c5cf9f53a8
1 changed files with 13 additions and 9 deletions
|
@ -1306,22 +1306,27 @@ dnode_get_path (dnode_end_t * mdn, const char *path_in, dnode_end_t * dn,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
*path = ch;
|
*path = ch;
|
||||||
#if 0
|
if (((grub_zfs_to_cpu64(((znode_phys_t *) DN_BONUS (&dnode_path->dn.dn))->zp_mode, dnode_path->dn.endian) >> 12) & 0xf) == 0xa)
|
||||||
if (((grub_zfs_to_cpu64(((znode_phys_t *) DN_BONUS (&dnode_path->dn.dn))->zp_mode, dnode_path->dn.endian) >> 12) & 0xf) == 0xa && ch)
|
|
||||||
{
|
{
|
||||||
char *oldpath = path, *oldpathbuf = path_buf;
|
char *oldpath = path, *oldpathbuf = path_buf;
|
||||||
|
grub_size_t bonuslen;
|
||||||
|
bonuslen = (grub_uint8_t *) (&dnode_path->dn.dn + 1)
|
||||||
|
- (grub_uint8_t *) DN_BONUS (&dnode_path->dn.dn);
|
||||||
|
if (bonuslen <= sizeof (znode_phys_t))
|
||||||
|
err = grub_error (GRUB_ERR_BAD_FS,
|
||||||
|
"incorrect or unsupported symlink");
|
||||||
path = path_buf
|
path = path_buf
|
||||||
= grub_malloc (sizeof (dnode_path->dn.dn.dn_bonus)
|
= grub_malloc (bonuslen - sizeof (znode_phys_t)
|
||||||
- sizeof (znode_phys_t) + grub_strlen (oldpath) + 1);
|
+ grub_strlen (oldpath) + 1);
|
||||||
if (!path_buf)
|
if (!path_buf)
|
||||||
{
|
{
|
||||||
grub_free (oldpathbuf);
|
grub_free (oldpathbuf);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
grub_memcpy (path,
|
grub_memcpy (path, (char *) DN_BONUS(&dnode_path->dn.dn)
|
||||||
(char *) DN_BONUS(&dnode_path->dn.dn) + sizeof (znode_phys_t),
|
+ sizeof (znode_phys_t),
|
||||||
sizeof (dnode_path->dn.dn.dn_bonus) - sizeof (znode_phys_t));
|
bonuslen - sizeof (znode_phys_t));
|
||||||
path [sizeof (dnode_path->dn.dn.dn_bonus) - sizeof (znode_phys_t)] = 0;
|
path[bonuslen - sizeof (znode_phys_t)] = 0;
|
||||||
grub_memcpy (path + grub_strlen (path), oldpath,
|
grub_memcpy (path + grub_strlen (path), oldpath,
|
||||||
grub_strlen (oldpath) + 1);
|
grub_strlen (oldpath) + 1);
|
||||||
|
|
||||||
|
@ -1339,7 +1344,6 @@ dnode_get_path (dnode_end_t * mdn, const char *path_in, dnode_end_t * dn,
|
||||||
grub_free (dn_new);
|
grub_free (dn_new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!err)
|
||||||
|
|
Loading…
Reference in a new issue