diff options
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -344,19 +344,19 @@ exit: void *tcplistener(void *arg) { pthread_t tcpserverth; - int s, *sp = (int *)arg; + int s, listensock = (int) arg; struct sockaddr_storage from; socklen_t fromlen = sizeof(from); - listen(*sp, 0); + listen(listensock, 0); for (;;) { - s = accept(*sp, (struct sockaddr *)&from, &fromlen); + s = accept(listensock, (struct sockaddr *)&from, &fromlen); if (s < 0) { debug(DBG_WARN, "accept failed"); continue; } - if (pthread_create(&tcpserverth, &pthread_attr, tcpservernew, (void *)&s)) { + if (pthread_create(&tcpserverth, &pthread_attr, tcpservernew, (void *) s)) { debug(DBG_ERR, "tcplistener: pthread_create failed"); shutdown(s, SHUT_RDWR); close(s); @@ -364,7 +364,6 @@ void *tcplistener(void *arg) { } pthread_detach(tcpserverth); } - free(sp); return NULL; } #else |