Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
U
uboot-imx
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Librem5
uboot-imx
Commits
30d7aae7
Commit
30d7aae7
authored
Sep 24, 2009
by
Wolfgang Denk
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of /home/wd/git/u-boot/custodians
parents
1c19863f
9a49e0e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
25 deletions
+43
-25
fs/ubifs/ubifs.c
fs/ubifs/ubifs.c
+43
-25
No files found.
fs/ubifs/ubifs.c
View file @
30d7aae7
...
...
@@ -379,9 +379,11 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
int
ret
;
char
*
next
;
char
fpath
[
128
];
char
symlinkpath
[
128
];
char
*
name
=
fpath
;
unsigned
long
root_inum
=
1
;
unsigned
long
inum
;
int
symlink_count
=
0
;
/* Don't allow symlink recursion */
strcpy
(
fpath
,
filename
);
...
...
@@ -397,6 +399,9 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
return
inum
;
for
(;;)
{
struct
inode
*
inode
;
struct
ubifs_inode
*
ui
;
/* Extract the actual part from the pathname. */
next
=
strchr
(
name
,
'/'
);
if
(
next
)
{
...
...
@@ -406,18 +411,48 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
}
ret
=
ubifs_finddir
(
sb
,
name
,
root_inum
,
&
inum
);
if
(
!
ret
)
return
0
;
inode
=
ubifs_iget
(
sb
,
inum
);
if
(
!
inode
)
return
0
;
ui
=
ubifs_inode
(
inode
);
if
((
inode
->
i_mode
&
S_IFMT
)
==
S_IFLNK
)
{
char
link_name
[
64
];
char
buf
[
128
];
/* We have some sort of symlink recursion, bail out */
if
(
symlink_count
++
>
8
)
{
printf
(
"Symlink recursion, aborting
\n
"
);
return
0
;
}
memcpy
(
link_name
,
ui
->
data
,
ui
->
data_len
);
link_name
[
ui
->
data_len
]
=
'\0'
;
if
(
link_name
[
0
]
==
'/'
)
{
/* Absolute path, redo everything without
* the leading slash */
next
=
name
=
link_name
+
1
;
root_inum
=
1
;
continue
;
}
/* Relative to cur dir */
sprintf
(
buf
,
"%s%s"
,
link_name
,
next
==
NULL
?
""
:
next
);
memcpy
(
symlinkpath
,
buf
,
sizeof
(
buf
));
next
=
name
=
symlinkpath
;
continue
;
}
/*
* Check if directory with this name exists
*/
/* Found the node! */
if
(
!
next
||
*
next
==
'\0'
)
{
if
(
ret
)
return
inum
;
break
;
}
if
(
!
next
||
*
next
==
'\0'
)
return
inum
;
root_inum
=
inum
;
name
=
next
;
...
...
@@ -614,10 +649,10 @@ int ubifs_load(char *filename, u32 addr, u32 size)
int
err
=
0
;
int
i
;
int
count
;
char
link_name
[
64
];
struct
ubifs_inode
*
ui
;
c
->
ubi
=
ubi_open_volume
(
c
->
vi
.
ubi_num
,
c
->
vi
.
vol_id
,
UBI_READONLY
);
/* ubifs_findfile will resolve symlinks, so we know that we get
* the real file here */
inum
=
ubifs_findfile
(
ubifs_sb
,
filename
);
if
(
!
inum
)
{
err
=
-
1
;
...
...
@@ -634,23 +669,6 @@ int ubifs_load(char *filename, u32 addr, u32 size)
goto
out
;
}
/*
* Check for symbolic link
*/
ui
=
ubifs_inode
(
inode
);
if
(((
inode
->
i_mode
&
S_IFMT
)
==
S_IFLNK
)
&&
ui
->
data_len
)
{
memcpy
(
link_name
,
ui
->
data
,
ui
->
data_len
);
link_name
[
ui
->
data_len
]
=
'\0'
;
printf
(
"%s is linked to %s!
\n
"
,
filename
,
link_name
);
ubifs_iput
(
inode
);
/*
* Now we have the "real" filename, call ubifs_load()
* again (recursive call) to load this file instead
*/
return
ubifs_load
(
link_name
,
addr
,
size
);
}
/*
* If no size was specified or if size bigger than filesize
* set size to filesize
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment