diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | linuxthreads/ChangeLog | 9 | ||||
-rw-r--r-- | linuxthreads/join.c | 11 | ||||
-rw-r--r-- | linuxthreads/manager.c | 23 | ||||
-rw-r--r-- | linuxthreads/pthread.c | 12 | ||||
-rw-r--r-- | linuxthreads/semaphore.c | 4 | ||||
-rw-r--r-- | nscd/nscd_gethst_r.c | 10 |
7 files changed, 49 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog index 52bdb75712..d7e60631bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-09-11 Ulrich Drepper <drepper@redhat.com> + + * nscd/nscd_gethst_r.c: Don't expect IPv6 addresses for IPv4 lookup. + Patch by Stephan Kulow. + 2001-09-08 Ben Collins <bcollins@debian.org> * sysdeps/arm/dl-machine.h (elf_machine_rel): Fix thinko in diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index b85f8c94df..b4c474a2a6 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,12 @@ +2001-09-11 Ulrich Drepper <drepper@redhat.com> + Wolfram Gloger <wg@malloc.de> + + * join.c: Protect all communications from and to manager with + TEMP_FAILURE_RETRY. + * manager.c: Likewise. + * pthread.c: Likewise. + * smeaphore.c: Likewise. + 2001-08-29 Ulrich Drepper <drepper@redhat.com> * spinlock.c (__pthread_lock): Top max_count value with diff --git a/linuxthreads/join.c b/linuxthreads/join.c index a0cdb41cd3..a6ed08c97a 100644 --- a/linuxthreads/join.c +++ b/linuxthreads/join.c @@ -77,7 +77,8 @@ void __pthread_do_exit(void *retval, char *currentframe) if (self == __pthread_main_thread && __pthread_manager_request >= 0) { request.req_thread = self; request.req_kind = REQ_MAIN_THREAD_EXIT; - __libc_write(__pthread_manager_request, (char *)&request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *)&request, sizeof(request))); suspend(self); /* Main thread flushes stdio streams and runs atexit functions. It also calls a handler within LinuxThreads which sends a process exit @@ -172,8 +173,8 @@ int pthread_join(pthread_t thread_id, void ** thread_return) request.req_thread = self; request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - __libc_write(__pthread_manager_request, - (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } @@ -210,8 +211,8 @@ int pthread_detach(pthread_t thread_id) request.req_thread = thread_self(); request.req_kind = REQ_FREE; request.req_args.free.thread_id = thread_id; - __libc_write(__pthread_manager_request, - (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index c7fd9653f2..41f53f38ef 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -130,7 +130,8 @@ __pthread_manager(void *arg) /* Raise our priority to match that of main thread */ __pthread_manager_adjust_prio(__pthread_main_thread->p_priority); /* Synchronize debugging of the thread manager */ - n = __libc_read(reqfd, (char *)&request, sizeof(request)); + n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, + sizeof(request))); ASSERT(n == sizeof(request) && request.req_kind == REQ_DEBUG); ufd.fd = reqfd; ufd.events = POLLIN; @@ -150,8 +151,17 @@ __pthread_manager(void *arg) } /* Read and execute request */ if (n == 1 && (ufd.revents & POLLIN)) { - n = __libc_read(reqfd, (char *)&request, sizeof(request)); - ASSERT(n == sizeof(request)); + n = TEMP_FAILURE_RETRY(__libc_read(reqfd, (char *)&request, + sizeof(request))); +#ifdef DEBUG + if (n < 0) { + char d[64]; + write(STDERR_FILENO, d, snprintf(d, sizeof(d), "*** read err %m\n")); + } else if (n != sizeof(request)) { + write(STDERR_FILENO, "*** short read in manager\n", 26); + } +#endif + switch(request.req_kind) { case REQ_CREATE: request.req_thread->p_retcode = @@ -266,8 +276,8 @@ pthread_start_thread(void *arg) if (__pthread_threads_debug && __pthread_sig_debug > 0) { request.req_thread = self; request.req_kind = REQ_DEBUG; - __libc_write(__pthread_manager_request, - (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); } /* Run the thread code */ @@ -921,7 +931,8 @@ void __pthread_manager_sighandler(int sig) struct pthread_request request; request.req_thread = 0; request.req_kind = REQ_KICK; - __libc_write(__pthread_manager_request, (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); } } diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index 721da9b4e7..f87413bc0f 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -631,7 +631,8 @@ int __pthread_initialize_manager(void) } /* Synchronize debugging of the thread manager */ request.req_kind = REQ_DEBUG; - __libc_write(__pthread_manager_request, (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); return 0; } @@ -653,7 +654,8 @@ int __pthread_create_2_1(pthread_t *thread, const pthread_attr_t *attr, request.req_args.create.arg = arg; sigprocmask(SIG_SETMASK, (const sigset_t *) NULL, &request.req_args.create.mask); - __libc_write(__pthread_manager_request, (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); retval = THREAD_GETMEM(self, p_retcode); if (__builtin_expect (retval, 0) == 0) @@ -785,8 +787,8 @@ static void pthread_onexit_process(int retcode, void *arg) request.req_thread = self; request.req_kind = REQ_PROCESS_EXIT; request.req_args.exit.code = retcode; - __libc_write(__pthread_manager_request, - (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); suspend(self); /* Main thread should accumulate times for thread manager and its children, so that timings for main thread account for all threads. */ @@ -1151,7 +1153,7 @@ void __pthread_message(char * fmt, ...) va_start(args, fmt); vsnprintf(buffer + 8, sizeof(buffer) - 8, fmt, args); va_end(args); - __libc_write(2, buffer, strlen(buffer)); + TEMP_FAILURE_RETRY(__libc_write(2, buffer, strlen(buffer))); } #endif diff --git a/linuxthreads/semaphore.c b/linuxthreads/semaphore.c index d3a1450978..e0dac41200 100644 --- a/linuxthreads/semaphore.c +++ b/linuxthreads/semaphore.c @@ -168,8 +168,8 @@ int __new_sem_post(sem_t * sem) } request.req_kind = REQ_POST; request.req_args.post = sem; - __libc_write(__pthread_manager_request, - (char *) &request, sizeof(request)); + TEMP_FAILURE_RETRY(__libc_write(__pthread_manager_request, + (char *) &request, sizeof(request))); } return 0; } diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c index ea2d674056..d371922430 100644 --- a/nscd/nscd_gethst_r.c +++ b/nscd/nscd_gethst_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -219,10 +219,6 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type, vec[2].iov_base = cp; vec[2].iov_len = hst_resp.h_addr_list_cnt * INADDRSZ; - ignore = alloca (hst_resp.h_addr_list_cnt * IN6ADDRSZ); - vec[3].iov_base = ignore; - vec[3].iov_len = hst_resp.h_addr_list_cnt * IN6ADDRSZ; - for (cnt = 0; cnt < hst_resp.h_addr_list_cnt; ++cnt) { resultbuf->h_addr_list[cnt] = cp; @@ -232,9 +228,9 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type, resultbuf->h_addrtype = AF_INET; resultbuf->h_length = INADDRSZ; - total_len += hst_resp.h_addr_list_cnt * (INADDRSZ + IN6ADDRSZ); + total_len += hst_resp.h_addr_list_cnt * INADDRSZ; - n = 4; + n = 3; } else { |