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
2fba3f21
Commit
2fba3f21
authored
Sep 15, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper socket address length
parent
af7c6f9f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
daemon.c
native/jni/core/daemon.c
+4
-3
log_daemon.c
native/jni/core/log_daemon.c
+1
-1
No files found.
native/jni/core/daemon.c
View file @
2fba3f21
...
@@ -113,7 +113,7 @@ void main_daemon() {
...
@@ -113,7 +113,7 @@ void main_daemon() {
struct
sockaddr_un
sun
;
struct
sockaddr_un
sun
;
fd
=
setup_socket
(
&
sun
,
MAIN_DAEMON
);
fd
=
setup_socket
(
&
sun
,
MAIN_DAEMON
);
if
(
xbind
(
fd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
)
))
if
(
xbind
(
fd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
.
sun_family
)
+
strlen
(
sun
.
sun_path
+
1
)
+
1
))
exit
(
1
);
exit
(
1
);
xlisten
(
fd
,
10
);
xlisten
(
fd
,
10
);
LOGI
(
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") daemon started
\n
"
);
LOGI
(
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") daemon started
\n
"
);
...
@@ -149,7 +149,8 @@ void main_daemon() {
...
@@ -149,7 +149,8 @@ void main_daemon() {
int
connect_daemon2
(
daemon_t
d
,
int
*
sockfd
)
{
int
connect_daemon2
(
daemon_t
d
,
int
*
sockfd
)
{
struct
sockaddr_un
sun
;
struct
sockaddr_un
sun
;
*
sockfd
=
setup_socket
(
&
sun
,
d
);
*
sockfd
=
setup_socket
(
&
sun
,
d
);
if
(
connect
(
*
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
)))
{
socklen_t
len
=
sizeof
(
sun
.
sun_family
)
+
strlen
(
sun
.
sun_path
+
1
)
+
1
;
if
(
connect
(
*
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
len
))
{
if
(
getuid
()
!=
UID_ROOT
||
getgid
()
!=
UID_ROOT
)
{
if
(
getuid
()
!=
UID_ROOT
||
getgid
()
!=
UID_ROOT
)
{
fprintf
(
stderr
,
"No daemon is currently running!
\n
"
);
fprintf
(
stderr
,
"No daemon is currently running!
\n
"
);
exit
(
1
);
exit
(
1
);
...
@@ -168,7 +169,7 @@ int connect_daemon2(daemon_t d, int *sockfd) {
...
@@ -168,7 +169,7 @@ int connect_daemon2(daemon_t d, int *sockfd) {
}
}
}
}
while
(
connect
(
*
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
)
))
while
(
connect
(
*
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
len
))
usleep
(
10000
);
usleep
(
10000
);
return
1
;
return
1
;
}
}
...
...
native/jni/core/log_daemon.c
View file @
2fba3f21
...
@@ -124,7 +124,7 @@ void log_daemon() {
...
@@ -124,7 +124,7 @@ void log_daemon() {
setsid
();
setsid
();
struct
sockaddr_un
sun
;
struct
sockaddr_un
sun
;
sockfd
=
setup_socket
(
&
sun
,
LOG_DAEMON
);
sockfd
=
setup_socket
(
&
sun
,
LOG_DAEMON
);
if
(
xbind
(
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
)
))
if
(
xbind
(
sockfd
,
(
struct
sockaddr
*
)
&
sun
,
sizeof
(
sun
.
sun_family
)
+
strlen
(
sun
.
sun_path
+
1
)
+
1
))
exit
(
1
);
exit
(
1
);
xlisten
(
sockfd
,
10
);
xlisten
(
sockfd
,
10
);
LOGI
(
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") logger started
\n
"
);
LOGI
(
"Magisk v"
xstr
(
MAGISK_VERSION
)
"("
xstr
(
MAGISK_VER_CODE
)
") logger started
\n
"
);
...
...
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