[Glibc-bsd-commits] r4495 - trunk/glibc-ports/linuxthreads
Petr Salinger
ps-guest at alioth.debian.org
Thu May 30 14:06:27 UTC 2013
Author: ps-guest
Date: 2013-05-30 14:06:27 +0000 (Thu, 30 May 2013)
New Revision: 4495
Modified:
trunk/glibc-ports/linuxthreads/pthread.c
Log:
apply any/local-linuxthreads-fd.diff
Modified: trunk/glibc-ports/linuxthreads/pthread.c
===================================================================
--- trunk/glibc-ports/linuxthreads/pthread.c 2013-05-30 14:05:41 UTC (rev 4494)
+++ trunk/glibc-ports/linuxthreads/pthread.c 2013-05-30 14:06:27 UTC (rev 4495)
@@ -662,6 +662,29 @@
free(__pthread_manager_thread_bos);
return -1;
}
+ /* Make sure the file descriptors of the pipe doesn't collide
+ with stdin, stdout or stderr if they have been closed. */
+ if (manager_pipe[0] < 3) {
+ int new_fd;
+ new_fd = fcntl(manager_pipe[0], F_DUPFD, 3);
+ close(manager_pipe[0]);
+ if (new_fd == -1) {
+ free(__pthread_manager_thread_bos);
+ return -1;
+ }
+ manager_pipe[0] = new_fd;
+ }
+ if (manager_pipe[1] < 3) {
+ int new_fd;
+ new_fd = fcntl(manager_pipe[1], F_DUPFD, 3);
+ close(manager_pipe[1]);
+ if (new_fd == -1) {
+ close(manager_pipe[0]);
+ free(__pthread_manager_thread_bos);
+ return -1;
+ }
+ manager_pipe[1] = new_fd;
+ }
#ifdef USE_TLS
/* Allocate memory for the thread descriptor and the dtv. */
More information about the Glibc-bsd-commits
mailing list