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
a6958ac1
Commit
a6958ac1
authored
Jun 16, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix adbd on GSIs
parent
d7d76f54
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
bootstages.c
native/jni/core/bootstages.c
+7
-0
file.c
native/jni/utils/file.c
+1
-3
No files found.
native/jni/core/bootstages.c
View file @
a6958ac1
...
...
@@ -534,8 +534,15 @@ void startup() {
// Remove some traits of Magisk
unlink
(
"/init.magisk.rc"
);
// GSIs will have to override /sbin/adbd with /system/bin/adbd
if
(
access
(
"/sbin/adbd"
,
F_OK
)
==
0
&&
access
(
"/system/bin/adbd"
,
F_OK
)
==
0
)
{
umount2
(
"/sbin/adbd"
,
MNT_DETACH
);
cp_afc
(
"/system/bin/adbd"
,
"/sbin/adbd"
);
}
// Create hardlink mirror of /sbin to /root
mkdir
(
"/root"
,
0750
);
clone_attr
(
"/sbin"
,
"/root"
);
full_read
(
"/sbin/magisk"
,
&
magisk
,
&
magisk_size
);
unlink
(
"/sbin/magisk"
);
full_read
(
"/sbin/magiskinit"
,
&
init
,
&
init_size
);
...
...
native/jni/utils/file.c
View file @
a6958ac1
...
...
@@ -166,7 +166,6 @@ void cp_afc(const char *source, const char *destination) {
xmkdirs
(
destination
,
a
.
st
.
st_mode
&
0777
);
src
=
xopen
(
source
,
O_RDONLY
|
O_CLOEXEC
);
dest
=
xopen
(
destination
,
O_RDONLY
|
O_CLOEXEC
);
fsetattr
(
dest
,
&
a
);
clone_dir
(
src
,
dest
);
close
(
src
);
close
(
dest
);
...
...
@@ -176,16 +175,15 @@ void cp_afc(const char *source, const char *destination) {
src
=
xopen
(
source
,
O_RDONLY
);
dest
=
xopen
(
destination
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
);
xsendfile
(
dest
,
src
,
NULL
,
a
.
st
.
st_size
);
fsetattr
(
src
,
&
a
);
close
(
src
);
close
(
dest
);
}
else
if
(
S_ISLNK
(
a
.
st
.
st_mode
))
{
char
buf
[
PATH_MAX
];
xreadlink
(
source
,
buf
,
sizeof
(
buf
));
xsymlink
(
buf
,
destination
);
setattr
(
destination
,
&
a
);
}
}
setattr
(
destination
,
&
a
);
}
void
clone_dir
(
int
src
,
int
dest
)
{
...
...
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