1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

close socket before exiting thread

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1259 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-09-25 18:29:04 +00:00
parent 3115cd8389
commit ae92753584

View File

@ -1839,10 +1839,11 @@ void *imap_thread(void *arg)
FD_SET(sockfd, &fdset); FD_SET(sockfd, &fdset);
FD_SET(threadfd, &fdset); FD_SET(threadfd, &fdset);
res = pselect(MAX(sockfd + 1, threadfd + 1), &fdset, NULL, NULL, NULL, &oldmask); res = pselect(MAX(sockfd + 1, threadfd + 1), &fdset, NULL, NULL, NULL, &oldmask);
if (timed_thread_test(mail->p_timed_thread)) { if (timed_thread_test(mail->p_timed_thread) || (res == -1 && errno == EINTR) || FD_ISSET(threadfd, &fdset)) {
timed_thread_exit(mail->p_timed_thread); if ((fstat(sockfd, &stat_buf) == 0) && S_ISSOCK(stat_buf.st_mode)) {
/* if a valid socket, close it */
close(sockfd);
} }
if ((res == -1 && errno == EINTR) || FD_ISSET(threadfd, &fdset)) {
timed_thread_exit(mail->p_timed_thread); timed_thread_exit(mail->p_timed_thread);
} else if (res > 0) { } else if (res > 0) {
if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) { if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {