Cleanup file descriptors and add info
This commit is contained in:
parent
60ca704a9e
commit
09392be069
4
su.c
4
su.c
@ -35,7 +35,7 @@ static void usage(int status) {
|
|||||||
FILE *stream = (status == EXIT_SUCCESS) ? stdout : stderr;
|
FILE *stream = (status == EXIT_SUCCESS) ? stdout : stderr;
|
||||||
|
|
||||||
fprintf(stream,
|
fprintf(stream,
|
||||||
"MagiskSU v" xstr(MAGISK_VERSION) "\n\n"
|
"MagiskSU v" xstr(MAGISK_VERSION) "(" xstr(MAGISK_VER_CODE) ")\n\n"
|
||||||
"Usage: su [options] [--] [-] [LOGIN] [--] [args...]\n\n"
|
"Usage: su [options] [--] [-] [LOGIN] [--] [args...]\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
|
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
|
||||||
@ -50,7 +50,7 @@ static void usage(int status) {
|
|||||||
" this is used almost exclusively by Superuser.apk\n"
|
" this is used almost exclusively by Superuser.apk\n"
|
||||||
" -mm, -M,\n"
|
" -mm, -M,\n"
|
||||||
" --mount-master run in the global mount namespace,\n"
|
" --mount-master run in the global mount namespace,\n"
|
||||||
" use if you need to publicly apply mounts");
|
" use if you need to publicly apply mounts\n");
|
||||||
exit2(status);
|
exit2(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ int socket_create_temp(char *path, size_t len) {
|
|||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_un sun;
|
struct sockaddr_un sun;
|
||||||
|
|
||||||
fd = xsocket(AF_LOCAL, SOCK_STREAM, 0);
|
fd = xsocket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||||
if (fcntl(fd, F_SETFD, FD_CLOEXEC)) {
|
if (fcntl(fd, F_SETFD, FD_CLOEXEC)) {
|
||||||
PLOGE("fcntl FD_CLOEXEC");
|
PLOGE("fcntl FD_CLOEXEC");
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ int socket_accept(int serv_fd) {
|
|||||||
PLOGE("select");
|
PLOGE("select");
|
||||||
}
|
}
|
||||||
|
|
||||||
return xaccept(serv_fd, NULL, NULL);
|
return xaccept4(serv_fd, NULL, NULL, SOCK_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define write_data(fd, data, data_len) \
|
#define write_data(fd, data, data_len) \
|
||||||
|
Loading…
Reference in New Issue
Block a user