mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Fix long known bug with handling device aliases residing not in devfs root.
Historically creation of device aliases created symbolic links using only name of target device as a link target, not considering current directory. Fix that by adding number of "../" chunks to the terget device name, required to get out of the current directory to devfs root first. MFC after: 1 month
This commit is contained in:
parent
e00bea9e62
commit
ca187878c0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259254
@ -486,9 +486,9 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanup)
|
||||
{
|
||||
struct cdev_priv *cdp;
|
||||
struct devfs_dirent *de;
|
||||
struct devfs_dirent *dd;
|
||||
struct devfs_dirent *dd, *dt;
|
||||
struct cdev *pdev;
|
||||
int de_flags, j;
|
||||
int de_flags, depth, j;
|
||||
char *q, *s;
|
||||
|
||||
sx_assert(&dm->dm_lock, SX_XLOCKED);
|
||||
@ -589,9 +589,17 @@ devfs_populate_loop(struct devfs_mount *dm, int cleanup)
|
||||
de->de_mode = 0755;
|
||||
de->de_dirent->d_type = DT_LNK;
|
||||
pdev = cdp->cdp_c.si_parent;
|
||||
j = strlen(pdev->si_name) + 1;
|
||||
dt = dd;
|
||||
depth = 0;
|
||||
while (dt != dm->dm_rootdir &&
|
||||
(dt = devfs_parent_dirent(dt)) != NULL)
|
||||
depth++;
|
||||
j = depth * 3 + strlen(pdev->si_name) + 1;
|
||||
de->de_symlink = malloc(j, M_DEVFS, M_WAITOK);
|
||||
bcopy(pdev->si_name, de->de_symlink, j);
|
||||
de->de_symlink[0] = 0;
|
||||
while (depth-- > 0)
|
||||
strcat(de->de_symlink, "../");
|
||||
strcat(de->de_symlink, pdev->si_name);
|
||||
} else {
|
||||
de->de_uid = cdp->cdp_c.si_uid;
|
||||
de->de_gid = cdp->cdp_c.si_gid;
|
||||
|
Loading…
Reference in New Issue
Block a user