Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/kern Pull up revision 1.128 via patch (requested by...
details: https://anonhg.NetBSD.org/src/rev/a5cd1403fb3f
branches: netbsd-2-0
changeset: 564680:a5cd1403fb3f
user: tron <tron%NetBSD.org@localhost>
date: Wed Mar 16 11:38:28 2005 +0000
description:
Pull up revision 1.128 via patch (requested by cube in ticket #1089):
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.
diffstat:
sys/kern/kern_descrip.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (35 lines):
diff -r cf30f42f6949 -r a5cd1403fb3f sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c Thu Feb 17 04:29:02 2005 +0000
+++ b/sys/kern/kern_descrip.c Wed Mar 16 11:38:28 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_descrip.c,v 1.123.2.1 2004/07/10 14:21:25 tron Exp $ */
+/* $NetBSD: kern_descrip.c,v 1.123.2.2 2005/03/16 11:38:28 tron Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.123.2.1 2004/07/10 14:21:25 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.123.2.2 2005/03/16 11:38:28 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -138,7 +138,7 @@
off--;
if (off < 0)
- return (0);
+ return (-1);
i = ((off + 1) << NDENTRYSHIFT) - 1;
if (i >= last)
@@ -1068,6 +1068,7 @@
newfdp->fd_fd.fd_knlistsize = -1;
newfdp->fd_fd.fd_himap = newfdp->fd_dhimap;
newfdp->fd_fd.fd_lomap = newfdp->fd_dlomap;
+ newfdp->fd_fd.fd_lastfile = -1;
}
/*
Home |
Main Index |
Thread Index |
Old Index