Commit b44f5122 authored by topjohnwu's avatar topjohnwu

Pass int directly as pointer

parent 17981730
...@@ -39,8 +39,7 @@ static void remove_modules() { ...@@ -39,8 +39,7 @@ static void remove_modules() {
} }
static void *request_handler(void *args) { static void *request_handler(void *args) {
int client = *((int *) args); int client = reinterpret_cast<intptr_t>(args);
delete (int *) args;
struct ucred credential; struct ucred credential;
get_client_cred(client, &credential); get_client_cred(client, &credential);
...@@ -173,9 +172,8 @@ static void main_daemon() { ...@@ -173,9 +172,8 @@ static void main_daemon() {
// Loop forever to listen for requests // Loop forever to listen for requests
for (;;) { for (;;) {
int *client = new int; int client = xaccept4(fd, nullptr, nullptr, SOCK_CLOEXEC);
*client = xaccept4(fd, nullptr, nullptr, SOCK_CLOEXEC); new_daemon_thread(request_handler, reinterpret_cast<void*>(client));
new_daemon_thread(request_handler, client);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment