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
df4161ff
Commit
df4161ff
authored
Mar 30, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reboot to recovery when running as recovery
parent
7a133eaf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
11 deletions
+17
-11
bootstages.cpp
native/jni/core/bootstages.cpp
+4
-1
daemon.cpp
native/jni/core/daemon.cpp
+9
-1
daemon.h
native/jni/include/daemon.h
+3
-6
magisk.h
native/jni/include/magisk.h
+0
-2
magiskhide.h
native/jni/magiskhide/magiskhide.h
+1
-1
No files found.
native/jni/core/bootstages.cpp
View file @
df4161ff
...
...
@@ -728,6 +728,9 @@ void late_start(int client) {
if
(
access
(
SECURE_DIR
,
F_OK
)
!=
0
)
xmkdir
(
SECURE_DIR
,
0700
);
// And reboot to make proper setup possible
if
(
RECOVERY_MODE
)
exec_command_sync
(
"/system/bin/reboot"
,
"recovery"
);
else
exec_command_sync
(
"/system/bin/reboot"
);
}
...
...
native/jni/core/daemon.cpp
View file @
df4161ff
...
...
@@ -23,7 +23,8 @@
#include <flags.h>
int
SDK_INT
=
-
1
;
struct
stat
SERVER_STAT
;
bool
RECOVERY_MODE
=
false
;
static
struct
stat
SERVER_STAT
;
static
void
verify_client
(
int
client
,
pid_t
pid
)
{
// Verify caller is the same as server
...
...
@@ -123,6 +124,13 @@ static void main_daemon() {
return
true
;
});
// Load config status
parse_prop_file
(
MAGISKTMP
"/config"
,
[](
auto
key
,
auto
val
)
->
bool
{
if
(
key
==
"RECOVERYMODE"
&&
val
==
"true"
)
RECOVERY_MODE
=
true
;
return
true
;
});
struct
sockaddr_un
sun
;
socklen_t
len
=
setup_sockaddr
(
&
sun
,
MAIN_SOCKET
);
fd
=
xsocket
(
AF_LOCAL
,
SOCK_STREAM
|
SOCK_CLOEXEC
,
0
);
...
...
native/jni/include/daemon.h
View file @
df4161ff
/* daemon.h - Utility functions for daemon-client communication
*/
#ifndef _DAEMON_H_
#define _DAEMON_H_
#pragma once
#include <pthread.h>
#include <sys/un.h>
...
...
@@ -87,4 +83,5 @@ void magiskhide_handler(int client);
void
su_daemon_handler
(
int
client
,
struct
ucred
*
credential
);
#endif
extern
int
SDK_INT
;
extern
bool
RECOVERY_MODE
;
native/jni/include/magisk.h
View file @
df4161ff
...
...
@@ -26,8 +26,6 @@
// Legacy crap
#define LEGACYCORE MODULEROOT "/.core"
extern
int
SDK_INT
;
constexpr
const
char
*
applet_names
[]
=
{
"magisk"
,
"su"
,
"resetprop"
,
"magiskhide"
,
nullptr
};
// Multi-call entrypoints
...
...
native/jni/magiskhide/magiskhide.h
View file @
df4161ff
...
...
@@ -10,7 +10,7 @@
#include <map>
#include <set>
#include
"daemon.h"
#include
<daemon.h>
#define SIGTERMTHRD SIGUSR1
...
...
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