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
c7e77725
Commit
c7e77725
authored
Oct 14, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce unnecessary stack memory allocation
parent
2dd4cf04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
bootstages.c
jni/daemon/bootstages.c
+10
-13
No files found.
jni/daemon/bootstages.c
View file @
c7e77725
...
...
@@ -401,7 +401,6 @@ static void daemon_init() {
DIR
*
dir
;
struct
dirent
*
entry
;
int
root
,
sbin
;
char
target
[
PATH_MAX
],
linkpath
[
PATH_MAX
];
// Setup links under /sbin
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
,
NULL
);
xmkdir
(
"/root"
,
0755
);
...
...
@@ -423,13 +422,13 @@ static void daemon_init() {
dir
=
xfdopendir
(
root
);
while
((
entry
=
xreaddir
(
dir
)))
{
if
(
strcmp
(
entry
->
d_name
,
"."
)
==
0
||
strcmp
(
entry
->
d_name
,
".."
)
==
0
)
continue
;
snprintf
(
target
,
sizeof
(
target
)
,
"/root/%s"
,
entry
->
d_name
);
snprintf
(
linkpath
,
sizeof
(
linkpath
)
,
"/sbin/%s"
,
entry
->
d_name
);
xsymlink
(
target
,
linkpath
);
snprintf
(
buf
,
PATH_MAX
,
"/root/%s"
,
entry
->
d_name
);
snprintf
(
buf2
,
PATH_MAX
,
"/sbin/%s"
,
entry
->
d_name
);
xsymlink
(
buf
,
buf2
);
}
for
(
int
i
=
0
;
applet
[
i
];
++
i
)
{
snprintf
(
linkpath
,
sizeof
(
linkpath
)
,
"/sbin/%s"
,
applet
[
i
]);
xsymlink
(
"/root/magisk"
,
linkpath
);
snprintf
(
buf2
,
PATH_MAX
,
"/sbin/%s"
,
applet
[
i
]);
xsymlink
(
"/root/magisk"
,
buf2
);
}
xmkdir
(
"/magisk"
,
0755
);
xmount
(
NULL
,
"/"
,
NULL
,
MS_REMOUNT
|
MS_RDONLY
,
NULL
);
...
...
@@ -459,9 +458,7 @@ static void daemon_init() {
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/system"
);
#endif
continue
;
}
if
(
strstr
(
line
,
" /vendor "
))
{
}
else
if
(
strstr
(
line
,
" /vendor "
))
{
seperate_vendor
=
1
;
sscanf
(
line
,
"%s"
,
buf
);
xmkdir_p
(
MIRRDIR
"/vendor"
,
0755
);
...
...
@@ -471,10 +468,10 @@ static void daemon_init() {
#else
LOGI
(
"mount: %s
\n
"
,
MIRRDIR
"/vendor"
);
#endif
continue
;
}
free
(
line
);
}
vec_de
ep_de
stroy
(
&
mounts
);
vec_destroy
(
&
mounts
);
if
(
!
seperate_vendor
)
{
xsymlink
(
MIRRDIR
"/system/vendor"
,
MIRRDIR
"/vendor"
);
#ifdef MAGISK_DEBUG
...
...
@@ -495,7 +492,7 @@ static void daemon_init() {
static
int
prepare_img
()
{
// First merge images
if
(
merge_img
(
"/data/magisk_merge.img"
,
MAINIMG
))
{
LOGE
(
"Image merge
%s -> %s failed!
\n
"
,
"/data/magisk_merge.img"
,
MAINIMG
);
LOGE
(
"Image merge
/data/magisk_merge.img -> "
MAINIMG
" failed!
\n
"
);
return
1
;
}
...
...
@@ -550,7 +547,7 @@ static int prepare_img() {
magiskloop
=
mount_image
(
MAINIMG
,
MOUNTPOINT
);
free
(
magiskloop
);
// Fix file seliux contexts
// Fix file seli
n
ux contexts
fix_filecon
();
return
0
;
}
...
...
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