Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

Commit

Permalink
Cleanup file descriptors and add info
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Jul 8, 2017
1 parent 91ea680 commit e282102
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions su.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void usage(int status) {
FILE *stream = (status == EXIT_SUCCESS) ? stdout : stderr;

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"
"Options:\n"
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
Expand All @@ -50,7 +50,7 @@ static void usage(int status) {
" this is used almost exclusively by Superuser.apk\n"
" -mm, -M,\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);
}

Expand Down
4 changes: 2 additions & 2 deletions su_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int socket_create_temp(char *path, size_t len) {
int fd;
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)) {
PLOGE("fcntl FD_CLOEXEC");
}
Expand Down Expand Up @@ -65,7 +65,7 @@ int socket_accept(int serv_fd) {
PLOGE("select");
}

return xaccept(serv_fd, NULL, NULL);
return xaccept4(serv_fd, NULL, NULL, SOCK_CLOEXEC);
}

#define write_data(fd, data, data_len) \
Expand Down

0 comments on commit e282102

Please sign in to comment.