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
022b18c8
Commit
022b18c8
authored
Dec 22, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly detect /data status
parent
b92b1dcd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
19 deletions
+21
-19
bootstages.c
core/jni/core/bootstages.c
+1
-1
log_monitor.c
core/jni/core/log_monitor.c
+6
-9
misc.c
core/jni/utils/misc.c
+14
-9
No files found.
core/jni/core/bootstages.c
View file @
022b18c8
...
...
@@ -497,7 +497,7 @@ void post_fs_data(int client) {
// ack
write_int
(
client
,
0
);
close
(
client
);
if
(
!
check_data
())
if
(
!
is_daemon_init
&&
!
check_data
())
goto
unblock
;
// Start the debug log
...
...
core/jni/core/log_monitor.c
View file @
022b18c8
...
...
@@ -82,8 +82,6 @@ static void *logger_thread(void *args) {
}
static
void
*
magisk_log_thread
(
void
*
args
)
{
int
have_data
=
0
;
// Buffer logs before we have data access
struct
vector
logs
;
vec_init
(
&
logs
);
...
...
@@ -97,10 +95,12 @@ static void *magisk_log_thread(void *args) {
LOGD
(
"log_monitor: magisk log dumper start"
);
FILE
*
log
;
FILE
*
log
=
NULL
;
for
(
char
*
line
;
xxread
(
pipefd
[
0
],
&
line
,
sizeof
(
line
))
>
0
;
free
(
line
))
{
if
(
!
have_data
)
{
if
((
have_data
=
check_data
()))
{
if
(
!
is_daemon_init
)
{
vec_push_back
(
&
logs
,
strdup
(
line
));
}
else
{
if
(
log
==
NULL
)
{
// Dump buffered logs to file
log
=
xfopen
(
LOGFILE
,
"w"
);
setbuf
(
log
,
NULL
);
...
...
@@ -110,13 +110,10 @@ static void *magisk_log_thread(void *args) {
free
(
tmp
);
}
vec_destroy
(
&
logs
);
}
else
{
vec_push_back
(
&
logs
,
strdup
(
line
));
}
}
if
(
have_data
)
fprintf
(
log
,
"%s"
,
line
);
}
}
return
NULL
;
}
...
...
core/jni/utils/misc.c
View file @
022b18c8
...
...
@@ -20,6 +20,7 @@
#include "logging.h"
#include "utils.h"
#include "resetprop.h"
unsigned
get_shell_uid
()
{
struct
passwd
*
ppwd
=
getpwnam
(
"shell"
);
...
...
@@ -46,18 +47,22 @@ unsigned get_radio_uid() {
}
int
check_data
()
{
int
ret
=
0
;
char
buffer
[
4096
];
FILE
*
fp
=
xfopen
(
"/proc/mounts"
,
"r"
);
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
fp
))
{
if
(
strstr
(
buffer
,
" /data "
))
{
if
(
strstr
(
buffer
,
"tmpfs"
)
==
NULL
)
ret
=
1
;
struct
vector
v
;
vec_init
(
&
v
);
file_to_vector
(
"/proc/mounts"
,
&
v
);
char
*
line
,
*
crypto
;
int
mnt
=
0
;
vec_for_each
(
&
v
,
line
)
{
if
(
strstr
(
line
,
" /data "
))
{
if
(
strstr
(
line
,
"tmpfs"
)
==
NULL
)
mnt
=
1
;
break
;
}
}
fclose
(
fp
);
return
ret
;
vec_deep_destroy
(
&
v
);
// /data is mounted and not tmpfs and data is unencrypted or vold is started
return
mnt
&&
(((
crypto
=
getprop
(
"ro.crypto.state"
))
&&
strcmp
(
crypto
,
"unencrypted"
)
==
0
)
||
getprop
(
"init.svc.vold"
));
}
/* All the string should be freed manually!! */
...
...
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