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
165eee10
Commit
165eee10
authored
Jan 31, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore working directory
parent
fe3c66a7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
2 deletions
+15
-2
activity.c
activity.c
+1
-0
daemon.c
daemon.c
+12
-1
su.c
su.c
+1
-0
su.h
su.h
+1
-1
No files found.
activity.c
View file @
165eee10
/*
/*
** Copyright 2017, John Wu (@topjohnwu)
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2008, Zinx Verituse (@zinxv)
** Copyright 2008, Zinx Verituse (@zinxv)
**
**
...
...
daemon.c
View file @
165eee10
/*
/*
** Copyright 2017, John Wu (@topjohnwu)
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2008, Zinx Verituse (@zinxv)
** Copyright 2008, Zinx Verituse (@zinxv)
**
**
...
@@ -287,6 +288,9 @@ static int daemon_accept(int fd) {
...
@@ -287,6 +288,9 @@ static int daemon_accept(int fd) {
LOGD
(
"remote uid: %d"
,
daemon_from_uid
);
LOGD
(
"remote uid: %d"
,
daemon_from_uid
);
daemon_from_pid
=
read_int
(
fd
);
daemon_from_pid
=
read_int
(
fd
);
LOGD
(
"remote req pid: %d"
,
daemon_from_pid
);
LOGD
(
"remote req pid: %d"
,
daemon_from_pid
);
int
mount_storage
=
read_int
(
fd
);
char
*
cwd
=
read_string
(
fd
);
LOGD
(
"remote cwd: %s"
,
cwd
);
struct
ucred
credentials
;
struct
ucred
credentials
;
socklen_t
ucred_length
=
sizeof
(
struct
ucred
);
socklen_t
ucred_length
=
sizeof
(
struct
ucred
);
...
@@ -303,7 +307,6 @@ static int daemon_accept(int fd) {
...
@@ -303,7 +307,6 @@ static int daemon_accept(int fd) {
daemon_from_pid
=
credentials
.
pid
;
daemon_from_pid
=
credentials
.
pid
;
}
}
int
mount_storage
=
read_int
(
fd
);
// The the FDs for each of the streams
// The the FDs for each of the streams
int
infd
=
recv_fd
(
fd
);
int
infd
=
recv_fd
(
fd
);
int
outfd
=
recv_fd
(
fd
);
int
outfd
=
recv_fd
(
fd
);
...
@@ -441,6 +444,10 @@ static int daemon_accept(int fd) {
...
@@ -441,6 +444,10 @@ static int daemon_accept(int fd) {
}
}
#endif
#endif
// Change directory to cwd
chdir
(
cwd
);
free
(
cwd
);
return
run_daemon_child
(
infd
,
outfd
,
errfd
,
argc
,
argv
);
return
run_daemon_child
(
infd
,
outfd
,
errfd
,
argc
,
argv
);
}
}
...
@@ -575,6 +582,8 @@ int connect_daemon(int argc, char *argv[], int ppid) {
...
@@ -575,6 +582,8 @@ int connect_daemon(int argc, char *argv[], int ppid) {
int
uid
=
getuid
();
int
uid
=
getuid
();
int
ptmx
=
-
1
;
int
ptmx
=
-
1
;
char
pts_slave
[
PATH_MAX
];
char
pts_slave
[
PATH_MAX
];
char
cwd
[
PATH_MAX
];
getcwd
(
cwd
,
sizeof
(
cwd
));
struct
sockaddr_un
sun
;
struct
sockaddr_un
sun
;
...
@@ -634,6 +643,8 @@ int connect_daemon(int argc, char *argv[], int ppid) {
...
@@ -634,6 +643,8 @@ int connect_daemon(int argc, char *argv[], int ppid) {
// Parent PID
// Parent PID
write_int
(
socketfd
,
ppid
);
write_int
(
socketfd
,
ppid
);
write_int
(
socketfd
,
mount_storage
);
write_int
(
socketfd
,
mount_storage
);
// CWD
write_string
(
socketfd
,
cwd
);
// Send stdin
// Send stdin
if
(
atty
&
ATTY_IN
)
{
if
(
atty
&
ATTY_IN
)
{
...
...
su.c
View file @
165eee10
// vim: set ts=4 expandtab sw=4 :
// vim: set ts=4 expandtab sw=4 :
/*
/*
** Copyright 2017, John Wu (@topjohnwu)
** Copyright 2015, Pierre-Hugues Husson <phh@phh.me>
** Copyright 2015, Pierre-Hugues Husson <phh@phh.me>
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2010, Adam Shanks (@ChainsDD)
** Copyright 2008, Zinx Verituse (@zinxv)
** Copyright 2008, Zinx Verituse (@zinxv)
...
...
su.h
View file @
165eee10
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
#ifndef VERSION_CODE
#ifndef VERSION_CODE
#define VERSION_CODE 6
#define VERSION_CODE 6
#endif
#endif
#define VERSION
"MAGISKSU:" xstr(VERSION_CODE) "
(topjohnwu)"
#define VERSION
xstr(VERSION_CODE) ":MAGISKSU
(topjohnwu)"
#define PROTO_VERSION 1
#define PROTO_VERSION 1
...
...
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