From 359955a1956383c238da1fab2a6b379f9ce90dd7 Mon Sep 17 00:00:00 2001 From: deischen Date: Sun, 21 Oct 2001 18:23:50 +0000 Subject: In the words of the submitter: In libc_r, if _FDLOCKS_ENABLED is not defined, there is no guarantee in many of the sycall wrappers that _thread_fd_table[fd] is initialized. This causes problems for programs that pass in file descriptors and execve() another program; when the exec'ed program tries to do an fcntl() or other syscall on the passed-in fd, it fails. Add calls to initialize the FD table entry for _thread_fd_lock and _thread_fd_lock_debug. Submitted by: Peter S. Housel --- lib/libc_r/uthread/uthread_fd.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/libc_r') diff --git a/lib/libc_r/uthread/uthread_fd.c b/lib/libc_r/uthread/uthread_fd.c index 98a70e0..060515a 100644 --- a/lib/libc_r/uthread/uthread_fd.c +++ b/lib/libc_r/uthread/uthread_fd.c @@ -1005,7 +1005,11 @@ _thread_fd_unlock(int fd, int lock_type) int _thread_fd_lock(int fd, int lock_type, struct timespec * timeout) { - return (0); + /* + * Insure that the file descriptor table is initialized for this + * entry: + */ + return (_thread_fd_table_init(fd)); } void @@ -1017,7 +1021,11 @@ int _thread_fd_lock_debug(int fd, int lock_type, struct timespec * timeout, char *fname, int lineno) { - return (0); + /* + * Insure that the file descriptor table is initialized for this + * entry: + */ + return (_thread_fd_table_init(fd)); } void -- cgit v1.1