Subject: CVS commit: src/sys/kern
To: None <>
From: Quentin Garnier <>
List: source-changes
Date: 01/12/2005 20:41:46
Module Name:	src
Committed By:	cube
Date:		Wed Jan 12 20:41:46 UTC 2005

Modified Files:
	src/sys/kern: kern_descrip.c

Log Message:
fd_lastfile should be -1 when there are no opened file descriptors.
Hence, make find_last_set return -1 in such situation, and initialize it
such.  Otherwise, with 0 meaning two things, it confused the F_CLOSEM
fcntl which could end up looping indifintely (PR#28929 by Brian Marcotte).

However, this change enlightens another bug in fdcopy(), where more entries
than needed were cleared in the new file descriptor table, so the memset()
call there is fixed too.

Analyzed with the help of Greg Oster.

To generate a diff of this commit:
cvs rdiff -r1.127 -r1.128 src/sys/kern/kern_descrip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.