You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
fix: using fgets in a file descriptor
This commit fixes the use of fgets in a file descriptor, which would make it easier to use fopen instead of using fdopen.
This commit is contained in:
@@ -58,7 +58,7 @@ void set_socket_create_context(const char *context) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(context, 1, strlen(context), sockcreate) != strlen(context)) {
|
if (write(sockcreate, context, strlen(context)) != (ssize_t)strlen(context)) {
|
||||||
LOGE("fwrite: %s\n", strerror(errno));
|
LOGE("fwrite: %s\n", strerror(errno));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
@@ -72,15 +72,15 @@ static void get_current_attr(char *output) {
|
|||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
snprintf(path, PATH_MAX, "/proc/self/attr/current");
|
snprintf(path, PATH_MAX, "/proc/self/attr/current");
|
||||||
|
|
||||||
int current = open(path, O_RDONLY | O_CLOEXEC);
|
FILE *current = fopen(path, "r");
|
||||||
if (current == -1) {
|
if (current == NULL) {
|
||||||
LOGE("Failed to open current: %s\n", strerror(errno));
|
LOGE("Failed to open current: %s\n", strerror(errno));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fgets(output, PATH_MAX, fileno(current)) == NULL) {
|
if (fgets(output, PATH_MAX, current) == NULL) {
|
||||||
LOGE("fgets: %s\n", strerror(errno));
|
LOGE("fgets: %s\n", strerror(errno));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user