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
84e4bd3d
Commit
84e4bd3d
authored
Feb 03, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move readlinkat fix into xwrap
parent
0ecfb63c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
rootdir.cpp
native/jni/init/rootdir.cpp
+0
-7
xwrap.cpp
native/jni/utils/xwrap.cpp
+11
-0
No files found.
native/jni/init/rootdir.cpp
View file @
84e4bd3d
...
@@ -217,14 +217,7 @@ static void recreate_sbin(const char *mirror, bool use_bind_mount) {
...
@@ -217,14 +217,7 @@ static void recreate_sbin(const char *mirror, bool use_bind_mount) {
struct
stat
st
;
struct
stat
st
;
fstatat
(
src
,
entry
->
d_name
,
&
st
,
AT_SYMLINK_NOFOLLOW
);
fstatat
(
src
,
entry
->
d_name
,
&
st
,
AT_SYMLINK_NOFOLLOW
);
if
(
S_ISLNK
(
st
.
st_mode
))
{
if
(
S_ISLNK
(
st
.
st_mode
))
{
#if defined(__i386__)
// readlinkat() may failed on x86 platform, returning random value
// instead of number of bytes placed in buf (length of link)
memset
(
buf
,
0
,
sizeof
(
buf
));
readlinkat
(
src
,
entry
->
d_name
,
buf
,
sizeof
(
buf
));
#else
xreadlinkat
(
src
,
entry
->
d_name
,
buf
,
sizeof
(
buf
));
xreadlinkat
(
src
,
entry
->
d_name
,
buf
,
sizeof
(
buf
));
#endif
xsymlink
(
buf
,
sbin_path
.
data
());
xsymlink
(
buf
,
sbin_path
.
data
());
}
else
{
}
else
{
sprintf
(
buf
,
"%s/%s"
,
mirror
,
entry
->
d_name
);
sprintf
(
buf
,
"%s/%s"
,
mirror
,
entry
->
d_name
);
...
...
native/jni/utils/xwrap.cpp
View file @
84e4bd3d
...
@@ -285,13 +285,24 @@ ssize_t xreadlink(const char *pathname, char *buf, size_t bufsiz) {
...
@@ -285,13 +285,24 @@ ssize_t xreadlink(const char *pathname, char *buf, size_t bufsiz) {
}
}
ssize_t
xreadlinkat
(
int
dirfd
,
const
char
*
pathname
,
char
*
buf
,
size_t
bufsiz
)
{
ssize_t
xreadlinkat
(
int
dirfd
,
const
char
*
pathname
,
char
*
buf
,
size_t
bufsiz
)
{
// readlinkat() may fail on x86 platform, returning random value
// instead of number of bytes placed in buf (length of link)
#if defined(__i386__) || defined(__x86_64__)
memset
(
buf
,
0
,
bufsiz
);
ssize_t
ret
=
readlinkat
(
dirfd
,
pathname
,
buf
,
bufsiz
);
ssize_t
ret
=
readlinkat
(
dirfd
,
pathname
,
buf
,
bufsiz
);
if
(
ret
==
-
1
)
{
if
(
ret
==
-
1
)
{
PLOGE
(
"readlinkat %s"
,
pathname
);
PLOGE
(
"readlinkat %s"
,
pathname
);
}
return
ret
;
#else
ssize_t
ret
=
readlinkat
(
dirfd
,
pathname
,
buf
,
bufsiz
);
if
(
ret
<
0
)
{
PLOGE
(
"readlinkat %s"
,
pathname
);
}
else
{
}
else
{
buf
[
ret
]
=
'\0'
;
buf
[
ret
]
=
'\0'
;
}
}
return
ret
;
return
ret
;
#endif
}
}
int
xsymlink
(
const
char
*
target
,
const
char
*
linkpath
)
{
int
xsymlink
(
const
char
*
target
,
const
char
*
linkpath
)
{
...
...
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