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
b01a8cac
Commit
b01a8cac
authored
Nov 26, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always try native accept4
parent
72db5b4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
xwrap.cpp
native/jni/utils/xwrap.cpp
+18
-7
No files found.
native/jni/utils/xwrap.cpp
View file @
b01a8cac
...
...
@@ -172,17 +172,28 @@ int xlisten(int sockfd, int backlog) {
return
ret
;
}
int
xaccept4
(
int
sockfd
,
struct
sockaddr
*
addr
,
socklen_t
*
addrlen
,
int
flags
)
{
static
int
accept4_compat
(
int
sockfd
,
struct
sockaddr
*
addr
,
socklen_t
*
addrlen
,
int
flags
)
{
int
fd
=
accept
(
sockfd
,
addr
,
addrlen
);
if
(
fd
==
-
1
)
{
PLOGE
(
"accept
4
"
);
}
PLOGE
(
"accept"
);
}
else
{
if
(
flags
&
SOCK_CLOEXEC
)
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
if
(
flags
&
SOCK_NONBLOCK
)
{
int
i
=
fcntl
(
fd
,
F_GETFL
);
fcntl
(
fd
,
F_SETFL
,
i
|
O_NONBLOCK
);
}
}
return
fd
;
}
int
xaccept4
(
int
sockfd
,
struct
sockaddr
*
addr
,
socklen_t
*
addrlen
,
int
flags
)
{
int
fd
=
(
int
)
syscall
(
__NR_accept4
,
sockfd
,
addr
,
addrlen
,
flags
);
if
(
fd
==
-
1
)
{
if
(
errno
==
ENOSYS
)
return
accept4_compat
(
sockfd
,
addr
,
addrlen
,
flags
);
PLOGE
(
"accept4"
);
}
return
fd
;
}
...
...
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