Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
945a52a9
Commit
945a52a9
authored
Apr 22, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle extremely rare edge case
parent
486b2c82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
module.cpp
native/jni/core/module.cpp
+17
-7
No files found.
native/jni/core/module.cpp
View file @
945a52a9
...
...
@@ -417,32 +417,42 @@ bool dir_node::prepare() {
auto
child
=
it
->
second
;
if
(
child
->
need_clone
())
{
if
(
node_type
>
type_id
<
skel_node
>
())
{
// Upgrade will fail, remove unsupported child node
delete
child
;
it
=
children
.
erase
(
it
);
continue
;
// Upgrade will fail
goto
delete_node
;
}
// Tell parent to upgrade self to skel
upgrade_skel
=
true
;
// If child is inter_node, upgrade to module
if
(
auto
nit
=
upgrade
<
module_node
,
inter_node
>
(
it
);
nit
!=
children
.
end
())
{
it
=
nit
;
goto
increment
;
goto
next_node
;
}
}
if
(
auto
dn
=
dyn_cast
<
dir_node
>
(
child
);
dn
&&
dn
->
is_dir
()
&&
!
dn
->
prepare
())
{
string
mirror
=
dn
->
mirror_path
();
if
(
access
(
mirror
.
data
(),
F_OK
)
!=
0
)
{
// It is actually possible that mirror does not exist
goto
delete_node
;
}
// Upgrade child to skeleton (shall always success)
it
=
upgrade
<
skel_node
>
(
it
);
auto
skel
=
iter_to_node
<
skel_node
>
(
it
);
string
mirror
=
skel
->
mirror_path
();
auto
dir
=
xopen_dir
(
mirror
.
data
());
for
(
dirent
*
entry
;
(
entry
=
xreaddir
(
dir
.
get
()));)
{
// Insert mirror nodes
skel
->
emplace
<
mirror_node
>
(
entry
->
d_name
,
entry
);
}
}
increment
:
next_node
:
++
it
;
continue
;
delete_node
:
// Remove the unsupported child node
delete
it
->
second
;
it
=
children
.
erase
(
it
);
continue
;
}
return
!
upgrade_skel
;
}
...
...
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