Hi ! So here is the patch: - 'new->tid' is replaced by a temporary 'tid' which value is forgotten - and 'new->tid' is now set in the tftpd_receive_request() thread.
Do you see any problems with this patch Jean-Pierre ? Regards, Ludovic -- www.palmopensource.com - The PalmOS open source portal www.drolez.com - Personal site
--- atftp-0.7.orig/tftpd.c +++ atftp-0.7/tftpd.c @@ -157,6 +157,7 @@ struct servent *serv; struct passwd *user; struct group *group; + pthread_t tid; #ifdef HAVE_MTFTP pthread_t mtftp_thread; @@ -466,7 +467,7 @@ new->client_info->next = NULL; /* Start a new server thread. */ - if (pthread_create(&new->tid, NULL, tftpd_receive_request, + if (pthread_create(&tid, NULL, tftpd_receive_request, (void *)new) != 0) { logger(LOG_ERR, "Failed to start new thread"); @@ -567,7 +568,8 @@ /* Detach ourself. That way the main thread does not have to * wait for us with pthread_join. */ - pthread_detach(pthread_self()); + data->tid = pthread_self(); + pthread_detach(data->tid); /* Read the first packet from stdin. */ data_size = data->data_buffer_size; @@ -732,8 +734,8 @@ tftpd_clientlist_free(data); /* free the thread structure */ - free(data); - + free(data); + logger(LOG_INFO, "Server thread exiting"); pthread_exit(NULL); }