Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 1997 09:47:08 -0600 (MDT)
From:      Steve Bauer <sbauer@rock.sdsmt.edu>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/3495: error in _thread_fd_table setup in libc_r -- thread_init.c
Message-ID:  <199705041547.JAA03968@rock.sdsmt.edu>
Resent-Message-ID: <199705041550.IAA00452@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3495
>Category:       kern
>Synopsis:       _thread_fd_table is not initialized with inherited fd's
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May  4 08:50:02 PDT 1997
>Last-Modified:
>Originator:     Steve Bauer
>Organization:
South Dakota School of Mines and Technology
>Release:        FreeBSD 2.2-STABLE i386
>Environment:

	The environment is the standard FreeBSD-2.2-Stable with ctm
patch 0263 applied to the system.
>Description:

	File desciptors that are inherited from the parent process (ie shell)
are not added to the _thread_fd_table.  Thus when they are accessed say using
read the error Bad File Descriptor is returned.  This effects programs that 
like to read from stdio using read.
>How-To-Repeat:

	Read data from stdin using read.
>Fix:
	
	Below is a patch that seems to fix the problem:

*** uthread_init.c.orig	Mon Apr 28 22:29:03 1997
--- uthread_init.c	Sun May  4 09:36:46 1997
***************
*** 183,188 ****
--- 183,189 ----
  			for (i = 0; i < _thread_dtablesize; i++) {
  				/* Initialise the file descriptor table: */
  				_thread_fd_table[i] = NULL;
+ 				_thread_fd_table_init(i);
  			}
  		}
  	}
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705041547.JAA03968>