diff --git a/src/unixsock.c b/src/unixsock.c
index d729477bbc54db999322dedfe581834dc9725c21..2c1665fc9fcbbdffc3c91935838a720e4fbf6d6f 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
close (fdin);
close (fdout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
fhout = fdopen (fdout, "w");
fclose (fhin); /* this closes fdin as well */
close (fdout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
/* change output buffer to line buffered mode */
fclose (fhin);
fclose (fhout);
pthread_exit ((void *) 1);
+ return ((void *) 0);
}
while (42)
errno = 0;
if (fgets (buffer, sizeof (buffer), fhin) == NULL)
{
+ if ((errno == EINTR) || (errno == EAGAIN))
+ continue;
+
if (errno != 0)
{
char errbuf[1024];
fclose (fhin);
fclose (fhout);
pthread_exit ((void *) 1);
+ return ((void *) 1);
}
if (strcasecmp (fields[0], "getval") == 0)
pthread_t th;
pthread_attr_t th_attr;
+ pthread_attr_init (&th_attr);
+ pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
+
if (us_open_socket () != 0)
pthread_exit ((void *) 1);
sstrerror (errno, errbuf, sizeof (errbuf)));
close (sock_fd);
sock_fd = -1;
+ pthread_attr_destroy (&th_attr);
pthread_exit ((void *) 1);
}
DEBUG ("Spawning child to handle connection on fd #%i", *remote_fd);
- pthread_attr_init (&th_attr);
- pthread_attr_setdetachstate (&th_attr, PTHREAD_CREATE_DETACHED);
-
- status = pthread_create (&th, &th_attr, us_handle_client, (void *) remote_fd);
+ status = plugin_thread_create (&th, &th_attr,
+ us_handle_client, (void *) remote_fd);
if (status != 0)
{
char errbuf[1024];
close (sock_fd);
sock_fd = -1;
+ pthread_attr_destroy (&th_attr);
status = unlink ((sock_file != NULL) ? sock_file : US_DEFAULT_PATH);
if (status != 0)
loop = 1;
- status = pthread_create (&listen_thread, NULL, us_server_thread, NULL);
+ status = plugin_thread_create (&listen_thread, NULL,
+ us_server_thread, NULL);
if (status != 0)
{
char errbuf[1024];