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
56988944
Commit
56988944
authored
Nov 12, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need to dup fd
parent
528601d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
main.cpp
native/jni/zygisk/main.cpp
+4
-6
No files found.
native/jni/zygisk/main.cpp
View file @
56988944
...
...
@@ -149,20 +149,18 @@ static void zygiskd(int socket) {
int
module_id
=
read_int
(
client
);
if
(
module_id
>=
0
&&
module_id
<
modules
.
size
()
&&
modules
[
module_id
])
{
exec_task
([
=
,
entry
=
modules
[
module_id
]]
{
int
dup
=
fcntl
(
client
,
F_DUPFD_CLOEXEC
);
struct
stat
s1
;
fstat
(
client
,
&
s1
);
entry
(
client
);
// Only close client if it is the same
as dup
so we don't
// Only close client if it is the same
file
so we don't
// accidentally close a re-used file descriptor.
// This check is required because the module companion
// handler could've closed the file descriptor already.
if
(
struct
stat
s1
;
fstat
(
client
,
&
s1
)
==
0
)
{
struct
stat
s2
{};
fstat
(
dup
,
&
s2
);
if
(
struct
stat
s2
;
fstat
(
client
,
&
s2
)
==
0
)
{
if
(
s1
.
st_dev
==
s2
.
st_dev
&&
s1
.
st_ino
==
s2
.
st_ino
)
{
close
(
client
);
}
}
close
(
dup
);
});
}
else
{
close
(
client
);
...
...
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