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
3599384b
Commit
3599384b
authored
Sep 25, 2021
by
vvb2060
Committed by
John Wu
Oct 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow fallback to /dev/pts
parent
4b307cad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
pts.cpp
native/jni/su/pts.cpp
+1
-0
su_daemon.cpp
native/jni/su/su_daemon.cpp
+12
-3
No files found.
native/jni/su/pts.cpp
View file @
3599384b
...
...
@@ -108,6 +108,7 @@ error:
int
get_pty_num
(
int
fd
)
{
int
pty_num
=
-
1
;
if
(
ioctl
(
fd
,
TIOCGPTN
,
&
pty_num
)
!=
0
)
{
LOGW
(
"get_pty_num failed with %d: %s
\n
"
,
errno
,
std
::
strerror
(
errno
));
return
-
1
;
}
return
pty_num
;
...
...
native/jni/su/su_daemon.cpp
View file @
3599384b
...
...
@@ -240,10 +240,19 @@ void su_daemon_handler(int client, const sock_cred *cred) {
ptmx
=
magiskpts
+
"/ptmx"
;
}
int
ptmx_fd
=
xopen
(
ptmx
.
data
(),
O_RDWR
);
int
unlock
=
0
;
ioctl
(
ptmx_fd
,
TIOCSPTLCK
,
&
unlock
);
send_fd
(
client
,
ptmx_fd
);
grantpt
(
ptmx_fd
);
unlockpt
(
ptmx_fd
);
int
pty_num
=
get_pty_num
(
ptmx_fd
);
if
(
pty_num
<
0
)
{
// Kernel issue? Fallback to /dev/pts
close
(
ptmx_fd
);
pts
=
"/dev/pts"
;
ptmx_fd
=
xopen
(
"/dev/ptmx"
,
O_RDWR
);
grantpt
(
ptmx_fd
);
unlockpt
(
ptmx_fd
);
pty_num
=
get_pty_num
(
ptmx_fd
);
}
send_fd
(
client
,
ptmx_fd
);
close
(
ptmx_fd
);
string
pts_slave
=
pts
+
"/"
+
to_string
(
pty_num
);
...
...
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